Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129981 陈华仁星 两个数的最小距离 C++ Compile Error 0 MS 0 KB 367 2025-09-07 10:49:18

Tests(0/0):


Code:

#include <iostream> #include <cmath> using namespace std; long long a[100001]; int main() { int n; long long=9e18; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%lld",&a[i]); } for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(abs(a[i]-a[j])>minn) { minn=abs(a[i]-a[j]); } } } printf("%lld",minn); return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:11: error: expected unqualified-id before '=' token
  long long=9e18;
           ^
Main.cc:18:22: error: 'minn' was not declared in this scope
    if(abs(a[i]-a[j])>minn)
                      ^
Main.cc:24:16: error: 'minn' was not declared in this scope
  printf("%lld",minn);
                ^
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:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
                      ^