[Codeforces1137D]Cooperative Game

题面

传送门

题解

太……太珂怕了……

考虑这么一个策略,我们选定两颗棋子(0,1),其中(0)每次都移动,(1)每两次移动一次

那么(2t)次之后(1)刚好到达点(T),我们把(T)编号为(1),环上按顺序依次标号为(2,3,...,c),那么此时(0)刚好在环上的(t+1)位置,那么还需要(2(c-t))(0)才能追上(1),且追上的位置为(c-t+1)

然后我们发现这个时候所有点走(t)次就能到达点(T)

太神仙了……

#include<iostream>
using namespace std;
char s[15];
inline int In(){int x;scanf("%d",&x);for(int i=x;i;--i)scanf("%s",s);return x;}
int main(){
	while(true){
		puts("next 0"),fflush(stdout),In();
		puts("next 0 1"),fflush(stdout);
		if(In()==2)break;
	}
	while(true){
		puts("next 0 1 2 3 4 5 6 7 8 9");
		fflush(stdout);if(In()==1)break;
	}
	puts("done"),fflush(stdout);
}
原文地址:https://www.cnblogs.com/bztMinamoto/p/10518100.html