Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define sc( x ) scanf( "%d" , &x )
- #define REP( i , n ) for( int i = 0 ; i < n ; ++i )
- #define clr( t , val ) memset( t , val , sizeof( t ) )
- #define pb push_back
- #define all( v ) v.begin() , v.end()
- #define SZ( v ) ((int)(v).size())
- #define mp make_pair
- #define fi first
- #define se second
- #define N 5000000
- #define IT 10000
- typedef long long ll;
- typedef unsigned long long ull;
- typedef vector< int > vi;
- typedef vector< ll > vll;
- typedef pair< int , int > pii;
- typedef vector< pii > vpii;
- typedef long double ld;
- map< ll , int > memo;
- int dp( ll n ){
- if( n == 0 ) return 0;
- if( n == 1LL ) return 1;
- if( memo.count( n ) ) return memo[ n ];
- int &dev = memo[ n ];
- if( n & 1 ) dev = 1 + dp( (n << 1LL) + n + 1LL );
- else dev = 1 + dp( n >> 1LL );
- return dev;
- }
- ll F[ N + 5 ];
- int G[] = { 1 , 2 , 3 , 6 , 7 , 9 , 18 , 19 , 25 , 27 , 54 , 55 , 73 , 97 , 129 , 171 , 231 , 235 , 313 , 327 , 649 , 654 , 655 , 667 , 703 , 871 , 1161 , 2223 , 2322 , 2323 , 2463 , 2919 , 3711 , 6171 , 10971 , 13255 , 17647 , 17673 , 23529 , 26623 , 34239 , 35497 , 35655 , 52527 , 77031 , 106239 , 142587 , 156159 , 216367 , 230631 , 410011 , 511935 , 626331 , 837799 , 1117065 , 1126015 , 1501353 , 1564063 , 1723519 , 2298025 , 3064033 , 3542887 , 3732423 , -1 };
- int main(){
- /*
- //cout << maxi << endl;
- int ct = 0;
- ll last = 0;
- for( int i = 1 ; i <= 5000001 ; ++i ){
- if( dp( i ) >= dp( last ) ){
- cout << " , " << i ;
- last = i;
- ct ++;
- }
- F[ i ] = last;
- }
- printf( "%d\n" , ct );
- */
- const int L = 63;
- int cases;
- sc( cases );
- REP( tc , cases ){
- int n;
- sc( n );
- int pos = upper_bound( G , G + L , n ) - G;
- pos --;
- printf( "%d\n" , G[ pos ] );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment