Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6612 柯宇希 两个数的最小距离 C++ Compile Error 0 MS 0 KB 564 2025-03-08 15:00:13

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() #include<limits.h> using namespace std; int main(){ int n,a[1001],temp; long long _min=LLONG_max cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<n-1){ temp=a[i]; for(int j=i+1;j<=n;j++){ _min=min(abs(temp-a[j])); } } cout<<_min<<emdl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:10:20: error: 'LLONG_max' was not declared in this scope
     long long _min=LLONG_max
                    ^
Main.cc:15:22: error: expected ';' before ')' token
     for(int i=1;i const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8.2/bits/stl_algobase.h:193:5: note:   template argument deduction/substitution failed:
Main.cc:18:32: note:   candidate expects 2 arguments, 1 provided
         _min=min(abs(temp-a[j]));
                                ^
In file included from /usr/include/c++/4.8.2/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8.2/ios:40,
                 from /usr/include/c++/4.8.2/ostream:38,
                 from /usr/include/c++/4.8.2/iostream:39,
                 from Main.cc:1:
/usr/include/c++/4.8.2/bits/stl_algobase.h:239:5: note: template const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8.2/bits/stl_algobase.h:239:5: note:   template argument deduction/substitution failed:
Main.cc:18:32: note:   candidate expects 3 arguments, 1 provided
         _min=min(abs(temp-a[j]));
                                ^
Main.cc:21:17: error: 'emdl' was not declared in this scope
     cout<_min<<emdl;
                 ^