Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
146505 王晏林 15相同数的次数 C++ Compile Error 0 MS 0 KB 234 2026-01-29 11:06:09

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int int xl,xt,n,cnt; n=xl=xt=0; for(int i=0;i<1000;i++){ xt++; if(xt>20)xt=1; xl++; if(xl>30)xl=1; if(xt==xl)cnt++; } cout<<cnt; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:9: error: two or more data types in declaration of 'xl'
     int xl,xt,n,cnt;
         ^
Main.cc:4:12: error: two or more data types in declaration of 'xt'
     int xl,xt,n,cnt;
            ^
Main.cc:4:15: error: two or more data types in declaration of 'n'
     int xl,xt,n,cnt;
               ^
Main.cc:4:17: error: two or more data types in declaration of 'cnt'
     int xl,xt,n,cnt;
                 ^
Main.cc:5:2: error: 'n' was not declared in this scope
  n=xl=xt=0;
  ^
Main.cc:5:4: error: 'xl' was not declared in this scope
  n=xl=xt=0;
    ^
Main.cc:5:7: error: 'xt' was not declared in this scope
  n=xl=xt=0;
       ^
Main.cc:11:13: error: 'cnt' was not declared in this scope
   if(xt==xl)cnt++;
             ^
Main.cc:13:8: error: 'cnt' was not declared in this scope
  cout<