Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
65317 余慕涵 两个数的最小距离 C++ Compile Error 0 MS 0 KB 439 2024-01-24 18:44:25

Tests(0/0):


Code:

#include <iostream> #include <cstdio> #include <cmath> using namespace std; int main(){ int n=0,m=0,k=0,j=0,c=0; long long x=0; cin>>n; int v[1000]; for(k=0;k<n;k++) cin>>v[k]; x=abs(v[1]-v[0]); for(k=0;k<n;k++){ for(k=j+1;k<n;k++){ c=abs(v[k]-v[j];) if(c<x) x=c;} } cout<<x; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:16:32: error: expected ')' before ';' token
                 c=abs(v[k]-v[j];)
                                ^
Main.cc:16:33: error: expected primary-expression before ')' token
                 c=abs(v[k]-v[j];)
                                 ^
Main.cc:6:13: warning: unused variable 'm' [-Wunused-variable]
     int n=0,m=0,k=0,j=0,c=0;
             ^