Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
106799 | 罗迎甲 | 两个数的最小距离II | C++ | Wrong Answer | 2 MS | 280 KB | 386 | 2025-01-16 16:35:34 |
#include<iostream> #include<cstdio> #include<cmath> using namespace std; int main() { int n,m; long long a[1010],i,j,d,e,b,f; cin>>n; for(i=0;i<n;i++) { cin>>a[i]; } e=abs(a[1]-a[0]); for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { d=abs(a[i]-a[j]); if(d<f) { f=d; e=i; b=j; } } } cout<<e<<" "<<b<<endl; return 0; }
------Input------
940 758926704 -960964048 -430141843 468532242 -880373592 683061267 519316474 147051688 719416223 901294929 930598316 344190816 -909295224 -703928603 982691789 -532274625 -865094105 -608855024 -180757338 -910192517 -725725557 -770344534 -56909888 323802311 -981526148 876907807 -238812122 904848323 -118180751 113460304 -343347383 -148747218 453083382 -135336696 -516925037 646757862 183906743 -276943828 -386044671 422454212 -202786322 -475659031 -893786081 -365403011 748358874 460671925 334228484 1
------Answer-----
357 665
------Your output-----
356 664