Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
145377 杨登博 22砝码的重量 C++ Compile Error 0 MS 0 KB 508 2026-01-25 15:01:11

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,ai[101],min=101; cin>>n; for(int i=1;i<=n;i++){ cin>>ai[i]; } for(int i=1;i<=n;i++){ if(min<ai[i]) min=ai[i]; s+=ai[i]; int w=s-min; } cout<<w; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:17:9: error: 's' was not declared in this scope
         s+=ai[i];
         ^
Main.cc:18:13: warning: unused variable 'w' [-Wunused-variable]
         int w=s-min;
             ^
Main.cc:20:11: error: 'w' was not declared in this scope
     cout<