Guest User

Untitled

a guest
Oct 27th, 2015
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. /*
  2. */
  3.  
  4. //#pragma comment(linker, "/STACK:16777216")
  5. #include <fstream>
  6. #include <iostream>
  7. #include <string>
  8. #include <complex>
  9. #include <math.h>
  10. #include <set>
  11. #include <vector>
  12. #include <map>
  13. #include <queue>
  14. #include <stdio.h>
  15. #include <stack>
  16. #include <algorithm>
  17. #include <list>
  18. #include <ctime>
  19. #include <memory.h>
  20. #include <ctime>
  21. #include <assert.h>
  22.  
  23. #define y0 sdkfaslhagaklsldk
  24. #define y1 aasdfasdfasdf
  25. #define yn askfhwqriuperikldjk
  26. #define j1 assdgsdgasghsf
  27. #define tm sdfjahlfasfh
  28. #define lr asgasgash
  29.  
  30. #define eps 1e-8
  31. #define M_PI 3.141592653589793
  32. #define bs 1000000007
  33. #define bsize 1024
  34. //#define N ((1<<20)+31)
  35. #define root 1
  36.  
  37. using namespace std;
  38.  
  39. int n,dp[1<<20];
  40. int N;
  41.  
  42. int solve(int x)
  43. {
  44. if (x==N)
  45. return 1;
  46. if (dp[x]!=-1)
  47. return dp[x];
  48. int found=0;
  49. if (x*2<=N)
  50. {
  51. if (solve(x*2)==0)
  52. found=1;
  53. }
  54. if (x+1<=N)
  55. {
  56. if (solve(x+1)==0)
  57. found=1;
  58. }
  59. dp[x]=found;
  60. return found;
  61. }
  62.  
  63. vector<long long> bad;
  64.  
  65. void show(long long v)
  66. {
  67. while (v)
  68. {
  69. cout<<v%2;
  70. v/=2;
  71. }
  72. cout<<endl;
  73. }
  74.  
  75. int main(){
  76. //freopen("beavers.in","r",stdin);
  77. //freopen("beavers.out","w",stdout);
  78. //freopen("F:/in.txt","r",stdin);
  79. //freopen("F:/output.txt","w",stdout);
  80. ios_base::sync_with_stdio(0);
  81.  
  82. bad.push_back(1);
  83. for (long long val=2;val<=1e15;val*=4)
  84. {
  85. for (int i=0;i<bad.size();i++)
  86. {
  87. if (bad[i]>val)
  88. break;
  89. bad.push_back(bad[i]+val);
  90. }
  91. }
  92. cout<<bad.size()<<endl;
  93.  
  94. for (int i=0;i<=100;i++)
  95. {
  96. show(bad[i]);
  97. }
  98. int tests;
  99. cin>>tests;
  100. for(;tests;--tests)
  101. {
  102. long long N;
  103. cin>>N;
  104. int id=lower_bound(bad.begin(),bad.end(),N)-bad.begin();
  105. if (bad[id]==N)
  106. cout<<"Ivica"<<endl;
  107. else
  108. cout<<"Marica"<<endl;
  109. }
  110. return 0;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment