URAL 1098 Questions 约瑟夫环

--------

int n;
int f[maxn];
char s[maxn];
int main(){
    int n=0;
    while (gets(s+n)){
        n=strlen(s);
    }
    s[n]=0;
    f[0]=0;
    for (int i=1;i<=n;i++) f[i]=(f[i-1]+1999)%i;
    if (s[f[n]]=='?') printf("Yes\n");
    else if (s[f[n]]==' ') printf("No\n");
    else printf("No comments\n");
	return 0;
}


--------

你可能感兴趣的:(URAL 1098 Questions 约瑟夫环)