| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 129977 | 陈华仁星 | 两个数的最小距离 | C++ | Compile Error | 0 MS | 0 KB | 354 | 2025-09-07 10:44:29 |
#include <iostream> #include <cmath> using namespace std; int a[100001]; int main() { int n; int minn=1e9; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(abs(a[i]-a[j])>min) { minn=abs(a[i]-a[j]); } } } printf("%d",minn); return 0; }
Main.cc: In function 'int main()':
Main.cc:18:22: error: invalid operands of types 'int' and '' to binary 'operator>'
if(abs(a[i]-a[j])>min)
^
Main.cc:9:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
Main.cc:12:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&a[i]);
^