Advertisement
semsem_elazazy

https://codeforces.com/group/nm0n1RosrQ/contest/375698/problem/K

Apr 14th, 2022
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #include<utility>
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define pi  3.14159
  7.  
  8. #define OO  2000000000
  9. //#define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
  10. using namespace std;
  11.  
  12. void yasmeen_fakhri(){
  13.   ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  14.   #ifndef ONLINE_JUDGE  
  15.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  16.   #endif
  17. }
  18.  
  19.  
  20. void solve(){
  21. ll a,b ;
  22. cin>>a>>b;
  23. double at = a/(0.08);
  24. double bt = b/(0.1);
  25.  
  26. if (at == bt ) cout<<at<<"\n";
  27. else {
  28. ll af1 =at*(0.08);
  29. ll af2 =at*(0.1);
  30. ll bf1 =bt*(0.08);
  31. ll bf2 =bt*(0.1);
  32. if (af1 == af2 ) cout<<at<<"\n";
  33. else if (bf1 == bf2 ) cout<<bt<<"\n";
  34. else cout<<-1<<"\n";
  35.  
  36. }
  37.  
  38.  
  39. }
  40.  
  41. int main() {
  42.    yasmeen_fakhri();
  43.  
  44. int test =1;
  45. cin>>test;
  46. while(test--){
  47.  solve();
  48.  
  49. }
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement