Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
78131 sh25_wanghy 连续出现的字符 C++ Accepted 1 MS 252 KB 575 2025-12-26 15:23:59

Tests(1/1):


#include <iostream> #include <string> using namespace std; int main() { int k; cin >> k; string str; cin >> str; char result = ' '; int count = 1; for (int i = 1; i < str.length(); ++i) { if (str[i] == str[i - 1]) { count++; if (count == k) { result = str[i]; break; } } else { count = 1; } } if (result != ' ') { cout << result; } else { cout << "No"; } return 0; }


Judgement Protocol: