fork download
  1. #include <functional>
  2. #include <algorithm>
  3. #include <iostream>
  4. #include <utility>
  5. #include <sstream>
  6. #include <iomanip>
  7. #include <numeric>
  8. #include <cstdlib>
  9. #include <cstring>
  10. #include <climits>
  11. #include <cstring>
  12. #include <vector>
  13. #include <cstdio>
  14. #include <string>
  15. #include <stack>
  16. #include <deque>
  17. #include <queue>
  18. #include <cmath>
  19. #include <map>
  20. #include <set>
  21. #define lwb lower_bound
  22. #define upb upper_bound
  23. #define X first
  24. #define Y second
  25. #define coud(a,b) cout<<fixed << setprecision((b)) << (a)
  26. #define L(x) ((x)<<1)
  27. #define R(x) (((x)<<1)+1)
  28. //#define int long long
  29. #define double long double
  30. #define joon ios :: sync_with_stdio(false)
  31. //#define cin fin
  32. //#define cout fout
  33.  
  34. using namespace std;
  35.  
  36. typedef pair<int, int> pii;
  37. typedef long long ll;
  38. const double pi = acos(-1);
  39. const double eps = 1e-7;
  40. int fib[100];
  41. map< int , int > chandomfib;// fibonacci index
  42.  
  43. int main()
  44. {
  45. fib[1]=1;
  46. chandomfib[1]=1;
  47. chandomfib[2]=2;
  48. fib[2]=2;
  49. for(int i=3;i<=20;i++)
  50. {
  51. fib[i]=fib[i-1]+fib[i-2];
  52. chandomfib[ fib[i] ]=i;
  53. }
  54. int n;
  55. cin>>n;
  56. if(n<11)
  57. {
  58. cout<<"Not enough money"<<endl;
  59. return 0;
  60. }
  61. cout<<"Let's play!"<<endl;
  62. fflush(stdout);
  63. int l=1;
  64. int r=144;
  65. int tmp=0;
  66. while(r-l+1>2)
  67. {
  68. // cout<<l<<" "<<r<<endl;
  69. int len=r-l+1;
  70. int ind=chandomfib[len];
  71. ind--;
  72. cout<<fib[ind-1]<<" ";
  73. for(int i=r-fib[ind-1]+1;i<=r;i++)
  74. cout<<i<<" ";
  75. cout<<endl;
  76. fflush(stdout);
  77. string judge;
  78. cin>>judge;
  79. if(fib[ind-1]==1 && judge[0]=='Y')
  80. {
  81. cout<<0<<" "<<r-fib[ind-1]+1<<endl;
  82. return 0;
  83. }
  84. if(judge[0]=='Y')
  85. l=r-fib[ind-1]+1;
  86. else
  87. r-=fib[ind-1];
  88. }
  89. cout<<1<<" "<<r<<endl;
  90. fflush(stdout);
  91. string judge;
  92. cin>>judge;
  93. int ans=l;
  94. if(judge[0]=='Y')
  95. ans=r;
  96. cout<<0<<" "<<ans<<endl;
  97. fflush(stdout);
  98. return 0;
  99. }
  100.  
  101.  
  102.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Not enough money