水题一道,就是题目描述太坑了。。。
题意:对于每个序号为k*n+1的位置,若此位置前面三个字母是相同的,则答案加1.
代码如下:
#include <cstdio>
char str[4000005];
int main ()
{
int n;
scanf("%d",&n);
getchar();
gets(str);
int ans = 0;
for(int i = n; str[i]; i+=n)
{
if(str[i-1]==str[i-2]&&str[i-2]==str[i-3])
ans++;
}
printf("%dn",ans);
return 0;
}
最后
以上就是害怕糖豆最近收集整理的关于cf_332A - Down the Hatch!(水题)的全部内容,更多相关cf_332A内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复