CF 1138 F. Cooperative Game

F. Cooperative Game

链接

分析:

  很有意思的一道题。

  

代码:

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;

inline int read() {
    int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
    for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
}

char s[15];
int IN() {
    int x = read();
    for (int i = 1; i <= x; ++i) scanf("%s", s);
    return x;
}
int main() {
    while (1) {
        puts("next 0"); fflush(stdout); IN();
        puts("next 0 1"); fflush(stdout); 
        if (IN() == 2) break;
    }
    while (1) {
        puts("next 0 1 2 3 4 5 6 7 8 9"); fflush(stdout);
        if (IN()==1) break;
    }
    puts("done"); fflush(stdout);
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/mjtcn/p/10524861.html
今日推荐