Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140197 万骏博 两个数的最小距离II C++ Accepted 2 MS 276 KB 407 2025-12-13 16:55:58

Tests(15/15):


Code:

#include<bits/stdc++.h> using namespace std; long long o[1001],l=9999999999,n,m,x,y; 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){ m=abs(o[i]-o[j]); if(m<l){ l=m; x=i; y=j; } } } } printf("%lld %lld",x,y); return 0; }