- 连续出现的字符
答案
- @ 2025-12-19 16:53:40
#include<bits/stdc++.h>
using namespace std;
int main(){
int k;cin>>k;
string s;cin>>s;
int n=s.length();
int cnt=0;
char ch=s[0];
for(int i=0;i<n;i++){
if(ch==s[i]){
cnt++;
if(cnt>=k){
cout<<ch;
return 0;
}
}
else{
cnt=1;
ch=s[i];
}
}
cout<<"No";
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 152
- 时间
- ms
- 内存
- MiB
- 难度
- 8
- 标签
- 递交数
- 167
- 已通过
- 23
- 上传者