SHARE
TWEET

Untitled

a guest Nov 17th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #2869
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. long long DivImp(long long l, long long c, long long cadran)
  7. {
  8.   if(cadran == 1) return 0;
  9.   if(l <= cadran / 2 && c <= cadran / 2)
  10.     return DivImp(l, c, cadran/2);
  11.   else if(l > cadran / 2 && c > cadran / 2)
  12.     return DivImp(l-cadran / 2, c - cadran / 2, cadran/2);
  13.   else if(l <= cadran / 2 && c > cadran / 2)
  14.         return DivImp(l, c-cadran/2, cadran/2) + cadran/2;
  15.     else
  16.         return DivImp(l-cadran/2, c, cadran/2) + cadran/2;
  17.  
  18. }
  19. int main()
  20. {
  21.     ifstream fin("tabela.in");
  22.     ofstream fout("tabela.out");
  23.  
  24.     long long l, c, l2, c2, cadran;
  25.     fin >> l >> c;
  26.  
  27.     l2 = (long long)1 << ((long long)log2((double)l-1) + 1);
  28.     c2 = (long long)1 << ((long long)log2((double)c-1) + 1);
  29.     cadran = max(l2, c2);
  30.  
  31.     fout << DivImp(l, c, cadran);
  32.    
  33.     return 0;
  34. }
  35. /**cin >> a >> b;
  36. cout << (a-1)^(b-1);
  37.  
  38.  
  39. */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top