Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
117219 | 施宸雨 | 寻找第二小的数 | C++ | Compile Error | 0 MS | 0 KB | 443 | 2025-04-14 21:50:13 |
#include <iostream> using namespace std; int main(){ int n; cin>>n; for(int i = 0;i < n;i++){ cin>>a[i]; } int minx = 188; for(int i = 0;i < n;i++){ if (a[i] < minx){ minx = a[i]; } } int secx = 198; for(int i = 0;i < n;i++){ if (a[i] != minx && a[i] < secx){ minx = a[i]; } } if (secx == 198){ cout<<"NO\n"; } else{ cout<<secx<<"\n"; } return 0; }
Main.cc: In function 'int main()': Main.cc:10:8: error: 'a' was not declared in this scope cin>>a[i]; ^ Main.cc:16:7: error: 'a' was not declared in this scope if (a[i] < minx){ ^ Main.cc:23:7: error: 'a' was not declared in this scope if (a[i] != minx && a[i] < secx){ ^