Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
5359 | 李伟和 | 两个数的最小距离 | C++ | Runtime Error | 1 MS | 256 KB | 311 | 2024-11-13 15:34:37 |
#include<iostream> #include<cmath> using namespace std; int main(){ int a[100],n,max=0,x=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } max=abs(a[n]-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