Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129208 罗安博 出现k次的字符 C++ Accepted 1 MS 284 KB 469 2025-08-22 19:31:37

Tests(10/10):


Code:

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