Advertisement
Guest User

Untitled

a guest
Feb 1st, 2013
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdint.h>
  3. #include <vector>
  4. #include <math.h>
  5. using namespace std;
  6.  
  7. int main()
  8. {  
  9.     int n;
  10.  
  11.     cin >> n;
  12.  
  13.     int k, a;
  14.  
  15.     int64_t max=0;
  16.     int64_t temp=0;
  17.  
  18.     for(int i=0; i<n; i++)
  19.     {
  20.         scanf("%d %d", &a, &k);
  21.        
  22.         int x=sqrt((double)k);
  23.         x=log((double)x)/log((double)2);
  24.        
  25.         while((1<<x)<sqrt((double)k))
  26.         {
  27.             x++;
  28.         }
  29.  
  30.         temp=x+a;
  31.  
  32.         if(temp>max)
  33.         {
  34.             max=temp;
  35.         }
  36.     }
  37.  
  38.     cout <<  max;
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement