# Dwarves, Hats and Extrasensory Abilities Codeforces - 1063C

https://codeforces.com/contest/1063/problem/C

1.写成fflush(input)

2.CF不能只输出\n，必须手动fflush(output)

 1 #include<cstdio>
2 #include<algorithm>
3 #include<cstring>
4 #include<vector>
5 using namespace std;
6 #define fi first
7 #define se second
8 #define mp make_pair
9 #define pb push_back
10 typedef long long ll;
11 typedef unsigned long long ull;
12 typedef pair<int,int> pii;
13 char tmp[233],c;
14 int n;
15 int main()
16 {
17     int l,r,mid,t,i;
18     scanf("%d",&n);
19     printf("%d %d\n",1000000000,1000000000);
20     fflush(stdout);
21     scanf("%s",tmp);
22     c=tmp[0];
23     if(n==1)
24     {
25         printf("%d %d %d %d\n",0,1,1,0);
26         return 0;
27     }
28     l=1;r=2000000000-1;
29     for(i=2;i<=n;++i)
30     {
31         mid=l+((r-l)>>1);
32         t=mid/2;
33         printf("%d %d\n",t,mid-t);
34         fflush(stdout);
35         scanf("%s",tmp);
36         if(tmp[0]==c)    r=mid-1;
37         else    l=mid+1;
38     }
39     mid=l+((r-l)>>1);
40     t=mid/2;
41     printf("%d %d %d %d\n",t,mid-t,t+1,mid-t-1);
42     return 0;
43 }
View Code

posted @ 2018-10-25 18:42  hehe_54321  阅读(194)  评论(0编辑  收藏  举报