Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3008 | 莫业祁 | 两个数的最小距离II | C++ | Wrong Answer | 1 MS | 272 KB | 539 | 2024-03-16 17:20:10 |
# include<iostream> # include<cmath> using namespace std; int n,temp=0; int a[1002]; int Min=1000000000,I=0,J=0; int main(){ cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<n;i++){ for(int j=i+1;j<=n;j++){ if(a[j]-a[i]<0) temp=(a[j]-a[i])*-1; else temp=(a[j]-a[i])*-1; if(temp<Min){ Min=temp; I=i; J=j; } } } cout<<I<<' '<<J; return 0; }
------Input------
815 -709065349 945173367 793167292 -727297898 961459714 -525333008 357981149 -338216299 -790533583 175147282 -401929630 -595452787 174419119 -661528496 558727304 -764073687 42336268 713919276 718589230 -362134115 -695301394 -989727546 -94274536 -758484291 966527063 373881347 701252276 886415446 81607364 408192422 713538653 -923309753 -224127040 823491298 -544895962 463208467 457572653 -143715549 627234529 590527846 595864830 19536503 -157698889 -93573607 407628058 -626627387 -632379383 -35164649
------Answer-----
389 747
------Your output-----
90 348