Gym102156J The Good, the Bad and the Ugly

Posted cjoiershiina-mashiro

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gym102156J The Good, the Bad and the Ugly相关的知识,希望对你有一定的参考价值。

Link
显然只要到了原点,我们就能轻松地进行判断。
首先我们观察到,在第一次到达原点之前,我们不可能越过而不经过原点。
考虑倍增,先往右跳(1)步,然后往左跳(c)步,再往右跳(c^2)步,(cdots),第(i)轮跳(c^{i-1})步。
(c=3.5),那么我们就可以在(25m)次指令内到达原点。

#include<cstdio>
int read(){int x;scanf("%d",&x);return x;}
int query(int f){return printf("%c",f?‘+‘:‘-‘),fflush(stdout),read();}
int main()
{
    for(int s=1,f=1,is0=0;!is0;f^=1,s*=3.5) for(int i=1;!is0&&i<=s;++i) is0=query(f);
    return puts(query(1)||query(0)? "! ugly":query(0)? "! good":"! bad"),0;
}

以上是关于Gym102156J The Good, the Bad and the Ugly的主要内容,如果未能解决你的问题,请参考以下文章

CF::Gym 100113K - The Merry Student Life During the Term. . .

Gym 100917F Find the Length

Gym 101666K King of the Waves(dfs)

Gym - 101806T: Touch The Sky(贪心)

Gym 100952 A. Who is the winner?

Soldom do i go to the gym这里的seldom do 怎么理解