| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 6602 | 黄宜洋 | 两个数的最小距离 | C++ | Compile Error | 0 MS | 0 KB | 642 | 2025-03-08 14:54:54 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<limits.h> #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a[1001],n,b[1001]; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ b[i]=a[i]-a[j]; if(b[i]<0) b[i]*=-1; } } long long nmin=INT_MAX; for(int i=0;i<n;i++){ nmin=min(nmin,b[i]); } cout<<nmin; return 0; }
Main.cc: In function 'int main()':
Main.cc:22:27: error: no matching function for call to 'min(long long int&, int&)'
nmin=min(nmin,b[i]);
^
Main.cc:22:27: note: candidates are:
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:193:5: note: template 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:22:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
nmin=min(nmin,b[i]);
^
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:22:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
nmin=min(nmin,b[i]);
^