Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
112391 陈骏睿 两个数的最小距离 C++ Compile Error 0 MS 0 KB 550 2025-03-09 14:06:02

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,a[1000],x,=0,min=1000; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ x=a[i]-a[j]; if(min>x){ min=x; } } } cout<<x; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:21: error: expected unqualified-id before '=' token
     int n,a[1000],x,=0,min=1000;
                     ^
Main.cc:16:20: error: invalid operands of types '' and 'int' to binary 'operator>'
             if(min>x){
                    ^
Main.cc:17:20: error: overloaded function with no contextual type information
                 min=x;
                    ^