Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
6600 | 黄宜洋 | 两个数的最小距离 | C++ | Wrong Answer | 3 MS | 272 KB | 636 | 2025-03-08 14:53:51 |
#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; } } int nmin=INT_MAX; for(int i=0;i<n;i++){ nmin=min(nmin,b[i]); } cout<<nmin; 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