Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
104689 | 石水生 | 最大值与最小值的差 | C++ | Compile Error | 0 MS | 0 KB | 237 | 2025-01-08 10:45:11 |
#include <bits/stdc++.h> using namespace std; int main(){ int n; int a[n]; cin>>n; cin>>a[0]; int max=min=a[0]; for(int i=1;i<n;i++){ cin>>a[i]; if(a[i]>max) max=a[i]; if(a[i]<min) min=a[i]; } cout<<max-min; }
Main.cc: In function 'int main()': Main.cc:8:13: error: overloaded function with no contextual type information int max=min=a[0]; ^ Main.cc:12:11: error: invalid operands of types 'int' and '' to binary 'operator<' if(a[i]' to binary 'operator-' cout<