| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 140209 | 田祥江 | 两个数的最小距离II | C++ | Compile Error | 0 MS | 0 KB | 414 | 2025-12-13 17:01:20 |
#include<bits/stdc++.h> using namespace std; int a[1000]; int main(){ int n,k,x,y; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } min=abs(a[1]-a[2]); x=1; y=2; for(int i=1;i<=n;i++){ for(int j=i+1;j<=n;j++){ if(i!=j){ k=abs(a[i]-a[j]); if(k<min){ min=k; x=i; y=j; } } } } cout<<x<<" "<<y<<endl; }
Main.cc: In function 'int main()':
Main.cc:10:7: error: overloaded function with no contextual type information
min=abs(a[1]-a[2]);
^
Main.cc:17:10: error: invalid operands of types 'int' and '' to binary 'operator<'
if(k