Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
5360 | 李伟和 | 两个数的最小距离 | C++ | Runtime Error | 1 MS | 268 KB | 315 | 2024-11-13 15:38:07 |
#include<iostream> #include<cmath> using namespace std; int main(){ long long n,a[100],max,x=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } max=abs(a[1]-a[0]); for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++) x=abs(a[i]-a[j]); if(x<max){ max=x; } } cout<<max; return 0; }
Runtime Error:Segmentation fault