Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- */
- //#pragma comment(linker, "/STACK:16777216")
- #include <fstream>
- #include <iostream>
- #include <string>
- #include <complex>
- #include <math.h>
- #include <set>
- #include <vector>
- #include <map>
- #include <queue>
- #include <stdio.h>
- #include <stack>
- #include <algorithm>
- #include <list>
- #include <ctime>
- #include <memory.h>
- #include <ctime>
- #include <assert.h>
- #define y0 sdkfaslhagaklsldk
- #define y1 aasdfasdfasdf
- #define yn askfhwqriuperikldjk
- #define j1 assdgsdgasghsf
- #define tm sdfjahlfasfh
- #define lr asgasgash
- #define eps 1e-8
- #define M_PI 3.141592653589793
- #define bs 1000000007
- #define bsize 1024
- //#define N ((1<<20)+31)
- #define root 1
- using namespace std;
- int n,dp[1<<20];
- int N;
- int solve(int x)
- {
- if (x==N)
- return 1;
- if (dp[x]!=-1)
- return dp[x];
- int found=0;
- if (x*2<=N)
- {
- if (solve(x*2)==0)
- found=1;
- }
- if (x+1<=N)
- {
- if (solve(x+1)==0)
- found=1;
- }
- dp[x]=found;
- return found;
- }
- vector<long long> bad;
- void show(long long v)
- {
- while (v)
- {
- cout<<v%2;
- v/=2;
- }
- cout<<endl;
- }
- int main(){
- //freopen("beavers.in","r",stdin);
- //freopen("beavers.out","w",stdout);
- //freopen("F:/in.txt","r",stdin);
- //freopen("F:/output.txt","w",stdout);
- ios_base::sync_with_stdio(0);
- bad.push_back(1);
- for (long long val=2;val<=1e15;val*=4)
- {
- for (int i=0;i<bad.size();i++)
- {
- if (bad[i]>val)
- break;
- bad.push_back(bad[i]+val);
- }
- }
- cout<<bad.size()<<endl;
- for (int i=0;i<=100;i++)
- {
- show(bad[i]);
- }
- int tests;
- cin>>tests;
- for(;tests;--tests)
- {
- long long N;
- cin>>N;
- int id=lower_bound(bad.begin(),bad.end(),N)-bad.begin();
- if (bad[id]==N)
- cout<<"Ivica"<<endl;
- else
- cout<<"Marica"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment