您的位置:首页 > 产品设计 > UI/UE

URAL - 1098 Questions——约瑟夫环

2018-03-27 16:36 441 查看
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5;
char s[maxn];
int dp[maxn];
int main() {
int n = 0;
while (gets(s + n)) n = strlen(s);
s
= '\0';
dp[0] = 0;
for (int i = 1; i <= n; i++) dp[i] = (dp[i-1]+1999)%i;
if (s[dp
] == '?') printf("Yes\n");
else if (s[dp
] == ' ') printf("No\n");
else printf("No comments\n");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: