Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
160230 邓弘锐 出现k次的字符 C++ Accepted 1 MS 268 KB 340 2026-09-13 14:39:08

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; string s; int k,cnt=0; int main(){ cin>>k; cin>>s; s=" "+s; int len=s.size(); for(int i=1;i<len;i++){ if(s[i]==s[i-1]){ cnt++; if(cnt>=k){ cout<<s[i]; return 0; } } else{ cnt=1; } } cout<<"No"; return 0; }