URAL - 1098 Questions——约瑟夫环

网友投稿 564 2022-11-28

URAL - 1098 Questions——约瑟夫环

URAL - 1098 Questions——约瑟夫环

#include #include #include #include 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[n] = '

#include #include #include #include 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[n] = '\0'; dp[0] = 0; for (int i = 1; i <= n; i++) dp[i] = (dp[i-1]+1999)%i; if (s[dp[n]] == '?') printf("Yes\n"); else if (s[dp[n]] == ' ') printf("No\n"); else printf("No comments\n"); return 0;}

'; dp[0] = 0; for (int i = 1; i <= n; i++) dp[i] = (dp[i-1]+1999)%i; if (s[dp[n]] == '?') printf("Yes\n"); else if (s[dp[n]] == ' ') printf("No\n"); else printf("No comments\n"); return 0;}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:UVA 821 Page Hopping——最短路
下一篇:LA 3882 And Then There Was One——约瑟夫环
相关文章

 发表评论

暂时没有评论,来抢沙发吧~