Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140176 万骏博 两个数的最小距离 C++ Compile Error 0 MS 0 KB 332 2025-12-13 16:39:47

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; long long o[1001],l=29,n,m; int main(){ scanf("%lld",&n); for(int i=1;i<=n;i++){ scanf("%lld",&o[i]); } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i!=j) l=min(abs(o[i],o[j]),l); } } printf("%lld",l); return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:14:25: error: no matching function for call to 'abs(long long int&, long long int&)'
      l=min(abs(o[i],o[j]),l);
                         ^
In file included from /usr/include/c++/5/cstdlib:72:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:47,
                 from Main.cc:1:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^
/usr/include/stdlib.h:774:12: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:442:5: note: candidate: template std::_Expr, _Tp> std::abs(const std::valarray<_Tp>&)
     _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
     ^
/usr/include/c++/5/bits/valarray_after.h:442:5: note:   template argument deduction/substitution failed:
Main.cc:14:25: note:   mismatched types 'const std::valarray<_Tp>' and 'long long int'
      l=min(abs(o[i],o[j]),l);
                         ^
In file included from /usr/include/c++/5/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:94,
                 from Main.cc:1:
/usr/include/c++/5/bits/valarray_after.h:442:5: note: candidate: template std::_Expr, typename _Dom::value_type> std::abs(const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
     ^
/usr/include/c++/5/bits/valarray_after.h:442:5: note:   template argument deduction/substitution failed:
Main.cc:14:25: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int'
      l=min(abs(o[i],o[j]),l);
                         ^
In file included from /usr/include/c++/5/ccomplex:38:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from Main.cc:1:
/usr/include/c++/5/complex:597:5: note: candidate: template _Tp std::abs(const std::complex<_Tp>&)
     abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
     ^
/usr/include/c++/5/complex:597:5: note:   template argument deduction/substitution failed:
Main.cc:14:25: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
      l=min(abs(o[i],o[j]),l);
                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:47:0,
                 from Main.cc:1:
/usr/include/c++/5/cstdlib:174:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/usr/include/c++/5/cstdlib:174:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/5/cstdlib:166:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^
/usr/include/c++/5/cstdlib:166:3: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:41:0,
                 from Main.cc:1:
/usr/include/c++/5/cmath:99:5: note: candidate: template constexpr typename __gnu_cxx::__enable_if::__value, double>::__type std::abs(_Tp)
     abs(_Tp __x)
     ^
/usr/include/c++/5/cmath:99:5: note:   template argument deduction/substitution failed:
Main.cc:14:25: note:   candidate expects 1 argument, 2 provided
      l=min(abs(o[i],o[j]),l);
                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:41:0,
                 from Main.cc:1:
/usr/include/c++/5/cmath:91:3: note: candidate: constexpr long double std::abs(long double)
   abs(long double __x)
   ^
/usr/include/c++/5/cmath:91:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/5/cmath:87:3: note: candidate: constexpr float std::abs(float)
   abs(float __x)
   ^
/usr/include/c++/5/cmath:87:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/5/cmath:81:3: note: candidate: constexpr double std::abs(double)
   abs(double __x)
   ^
/usr/include/c++/5/cmath:81:3: note:   candidate expects 1 argument, 2 provided
Main.cc:5:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
Main.cc:8:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld",&o[i]);
                       ^