Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
121692 张铖睿 18高于平均分的学生数量 C++ Compile Error 0 MS 0 KB 275 2025-06-08 08:59:27

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int sum=0,rs=0,a[101],n=0; double pj=0; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; sum+=a[i]; pj=double(sum)/n; for(int i=1;i<=n;i++) if(a[i]>pj) cnt++; cout<<cnt; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:10: error: 'i' was not declared in this scope
   sum+=a[i];
          ^
Main.cc:14:4: error: 'cnt' was not declared in this scope
    cnt++; 
    ^
Main.cc:15:8: error: 'cnt' was not declared in this scope
  cout<