Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
74530 石依灵 19斯诺克比赛 C++ Compile Error 0 MS 0 KB 337 2024-05-25 14:57:56

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int k=0,sum=0; for(int i=1;i<=7;i++){ cin>>a[i]; if(i>&&a[i]>0){ k=i; } } sum=a[1]*1+a[1]*k; for(int i=2;i<=7;i++){ if(a[i]>0){ sum+=a[i]*i; } } cout<<sum; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:14: error: 'a' was not declared in this scope
         cin>>a[i];
              ^
Main.cc:7:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
         if(i>&&a[i]>0){
                ^
Main.cc:7:17: error: expected ')' before '[' token
         if(i>&&a[i]>0){
                 ^
Main.cc:11:9: error: 'a' was not declared in this scope
     sum=a[1]*1+a[1]*k;
         ^
Main.cc:7:16: error: label 'a' used but not defined
         if(i>&&a[i]>0){
                ^