Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140945 杜禹轩 19斯诺克比赛 C++ Compile Error 0 MS 0 KB 278 2025-12-20 14:59:53

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n=0,a[8]; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } if(a[i]!=0){ int i=7; while(a[i]==0)i--; n+=a[1]*(i+1); } for(int i=2;i<=7;i++){ n+=a[i]*i; } cout<<n; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:7: error: 'i' was not declared in this scope
  if(a[i]!=0){
       ^
Main.cc:11:7: error: redeclaration of 'int i'
   int i=7;
       ^
Main.cc:10:7: note: 'i' previously declared here
  if(a[i]!=0){
       ^