Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3006 | 莫业祁 | 两个数的最小距离II | C++ | Compile Error | 0 MS | 0 KB | 542 | 2024-03-16 17:18:11 |
# include<iostream> # include<cmath> using namespace std; int n,temp=0; int a[1002]; int Min=1000000000,I=0,J=0; int main(){ cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ if(a[j]-a[i]<0) temp=(a[j]-a[i])*-1; else temp=(a[j]-a[i])*-1; if(temp<Min){ Min=temp; I=i; J=j; } } } cout<<I<<' '<<J; return 0; }
Main.cc:4:1: error: stray '\357' in program int n,temp=0; ^ Main.cc:4:1: error: stray '\274' in program Main.cc:4:1: error: stray '\214' in program Main.cc:4:9: error: expected initializer before 'temp' int n,temp=0; ^ Main.cc: In function 'int main()': Main.cc:8:10: error: 'n' was not declared in this scope cin>>n; ^ Main.cc:12:29: error: 'temp' was not declared in this scope if(a[j]-a[i]<0) temp=(a[j]-a[i])*-1; ^ Main.cc:13:18: error: 'temp' was not declared in this scope else temp=(a[j]-a[i])*-1; ^ Main.cc:14:16: error: 'temp' was not declared in this scope if(temp<Min){ ^