Advertisement
Zeinab_Hamdy

Untitled

Mar 23rd, 2023
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define ull unsigned ll
  5. #define nl "\n"
  6. #define sz(x) int(x.size())
  7. #define NumOfDigit(w) log10(w) + 1
  8. #define fill(arr, val) memset(arr, val , sizeof(arr))
  9. #define PI 3.141592654
  10. #define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
  11. #define all(v) v.begin(), v.end()
  12. #define rall(v) v.rbegin(), v.rend()
  13. #define fi first
  14. #define se second
  15. #define cin(v) for (auto&i:v) cin >> i;
  16. #define cout(v) for (auto&i:v) cout << i << " ";
  17. #define fixed(n) fixed << setprecision(n)
  18. //#define MOD 1e9 + 7
  19.  
  20.  
  21. void IO(){
  22. ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  23. }
  24. void files(){
  25. //freopen("filename.in" , "r" ,stdin);
  26. #ifndef ONLINE_JUDGE
  27. freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
  28. #endif
  29. }
  30. bool prime(ll n){
  31. if(n==2 || n==3) return true;
  32. if(n<2 || n%2==0 ) return false;
  33. for(int i=3;i<=sqrt(n);i+=2) if(n%i==0) return false;
  34. return true;
  35. }
  36.  
  37.  
  38.  
  39. void solve(){
  40.  
  41. ll x,y;
  42. cin >> x >> y;
  43. int tm=0;
  44. if( y % x !=0) tm++ , y-= y % x ;
  45.  
  46. if( x==y ) return void(cout << tm << nl);
  47.  
  48. ll mul = y/x ;
  49. if( mul % 2 ==0){
  50. cout << mul/2 + tm << nl;
  51. }
  52. else
  53. cout << mul/2 + 1 << nl;
  54.  
  55. }
  56.  
  57. int main(){
  58. IO(); // files();
  59.  
  60. int testCase=1; // one test case
  61. cin >> testCase ;
  62. while(testCase--)
  63. solve(); // my code
  64.  
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement