首页 > 其他 > 详细

[Codeforces1137D]Cooperative Game

时间:2019-03-12 18:01:19      阅读:132      评论:0      收藏:0      [点我收藏+]

题面

传送门

题解

技术分享图片

太……太珂怕了……

考虑这么一个策略,我们选定两颗棋子\(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);
}

[Codeforces1137D]Cooperative Game

原文:https://www.cnblogs.com/bztMinamoto/p/10518100.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!