結果
問題 | No.716 距離 |
ユーザー | himo |
提出日時 | 2019-09-17 18:29:39 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 350 bytes |
コンパイル時間 | 1,159 ms |
コンパイル使用メモリ | 162,416 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 13:21:27 |
合計ジャッジ時間 | 2,197 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main(){ int n; cin >>n; vector<int>a(n); for(int i=0;i<n;i++){ cin >> a.at(i); } sort(a.begin(),a.end()); int sasyou =10e7; int saidai =abs(a.at(0)-a.at(n-1)); for(int i=1;i<n;i++){ int x; x =abs(a.at(i-1)-a.at(i)); sasyou = min(sasyou,x); } cout <<sasyou << endl << saidai <<endl; }