Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
152910 左锶焜 出现k次的字符 C++ Compile Error 0 MS 0 KB 536 2026-05-05 19:15:05

Tests(0/0):


Code:

#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 k,s=1; char a[2501]; cin>>k>>a; for(int i=0;i<=strlen(a)-2;i++){ if(a[i]==a[i+1]){ s++;} else{ if(s>=k)} cout<<a[i];return 0; } s=1; } } cout<<"No"; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<=strlen(a)-2;i++){
                  ^
Main.cc:15:21: error: expected primary-expression before '}' token
             if(s>=k)}
                     ^
Main.cc: At global scope:
Main.cc:20:5: error: expected declaration before '}' token
     }
     ^