Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
100625 | 罗子童 | 出现k次的字符 | C++ | Accepted | 1 MS | 280 KB | 581 | 2024-12-08 18:28:22 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int s1=1,k; char s[1001]; cin>>k>>s; for(int i=0;s[i]!='\0';++i){ if(s1==k){ cout<<s[i]; return 0; } else { if(s[i]==s[i+1]) s1++; else s1=1; } }cout<<"No"; return 0; }