Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157813 杨正蠔 12满足条件的四位数 C++ Compile Error 0 MS 0 KB 519 2026-08-18 10:02:13

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 n; string x; int m=1; int g,s,b,q; cin>>n; for(int i=1;i<=n;i++){ cin>>x; g=x%10; s=x/10%10; b=x/100%10; q=x/1000; if(g>=s+b+q){ m+=1 } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:12: error: no match for 'operator%' (operand types are 'std::__cxx11::string {aka std::__cxx11::basic_string}' and 'int')
         g=x%10;
            ^
Main.cc:16:12: error: no match for 'operator/' (operand types are 'std::__cxx11::string {aka std::__cxx11::basic_string}' and 'int')
         s=x/10%10;
            ^
Main.cc:17:12: error: no match for 'operator/' (operand types are 'std::__cxx11::string {aka std::__cxx11::basic_string}' and 'int')
         b=x/100%10;
            ^
Main.cc:18:12: error: no match for 'operator/' (operand types are 'std::__cxx11::string {aka std::__cxx11::basic_string}' and 'int')
         q=x/1000;
            ^
Main.cc:21:9: error: expected ';' before '}' token
         }
         ^
Main.cc:23:5: error: expected '}' at end of input
     }
     ^