is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
#include<iostream>
- iit2009047 July 06, 2012#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<cstring>
using namespace std;
int fab[100];
int dp[70][70][2];
long long right;
void check()
{
int a = 0;
int b = 1;
int c = 0;
fab[0] = 1;
fab[1] = 1;
while ( c <= 64 ) {
c = a + b;
fab[c] = 1;
a = b;
b = c;
}
}
long long solve( int p , int c , int eq )
{
if ( p == -1 ) {
if( fab[c] == 1 )
return 1;
else
return 0;
}
if( dp[p][c][eq] != -1 )
return dp[p][c][eq];
extern long long right;
long long ans = 0;
if( eq ) {
if( ( 1<<p ) & right ) {
ans = ans + solve( p - 1 , c + 1 , 1 );
ans = ans + solve( p - 1 , c , 0 );
} else {
ans = ans + solve( p - 1 , c , 1 );
}
} else {
ans = ans + solve( p - 1 , c + 1 , 0 );
ans = ans + solve( p - 1 , c , 0 );
}
dp[p][c][eq] = ans;
return ans;
}
int main()
{
int n;
int t;
cin >> t;
memset( fab , 0 , sizeof( fab ) );
memset( dp , -1 , sizeof( dp ) );
check();
long long a , b , ans;
extern long long right;
while( t )
{
t--;
memset( dp , -1 , sizeof( dp ) );
fflush( stdin );
cin >> a >> b;
right = b;
ans = solve( 30, 0 , 1 );
if( a > 0 )
right = a - 1;
else
right = 0;
memset( dp , -1 , sizeof( dp ) );
right = a - 1;
ans = ans - solve( 30 , 0 , 1 );
cout << ans << "\n";
}
cin >> n;
return 0;
}