Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
6610 | 张文曦 | 两个数的最小距离 | C++ | Wrong Answer | 1 MS | 268 KB | 559 | 2025-03-08 14:58:55 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() #include<limits.h> using namespace std; int main(){ long long _min=LLONG_MAX,n,a[1001],temp; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ temp=a[i]; for(int j=1;j<=n;j++){ _min=min(abs(temp-a[j]),_min); } } cout<<_min; return 0; }
------Input------
815 -1565614346 1742863086 1438850937 -1602079444 2013771743 1775435781 -1198149663 568478650 -823916245 -1728550813 202810917 -951342908 -1338389222 201354591 2116909072 1964976871 2132285156 1996681049 2008734458 -1470540639 969970961 2021180595 2066350391 1963517098 -1675631022 -62811112 1280354905 1289694812 -871751877 -1538086436 -2126938739 -336032719 -1664452230 1785570478 600279047 1255020905 1625347245 1973504939 15731080 668901196 1279593658 -1994103153 -595737728 1499498949 -123727557
------Answer-----
3912
------Your output-----
0