| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 140207 | 刘益梵 | 两个数的最小距离II | C++ | Compile Error | 0 MS | 0 KB | 470 | 2025-12-13 17:00:45 |
#include<bits/stdc++.h> using namespace std; int a[1099]; long long mi,k; int main(){ int n,x,y; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%lld",&a[i]); } mi=abs(a[1]-a[2]); x=1; y=2; for(int i=1;i<=n;i++){ for(int j=1;j<=n;i++){ k=abs(a[i]-a[j]); else k=a[j]-a[i]; if(k<mi){ mi=k; x=i; y=j; } } } cout<<x<<" "<<y<<endl; return 0; }
Main.cc: In function 'int main()':
Main.cc:9:22: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
scanf("%lld",&a[i]);
^
Main.cc:18:7: error: 'else' without a previous 'if'
else k=a[j]-a[i];
^
Main.cc:7:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
Main.cc:9:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&a[i]);
^