結果

問題 No.716 距離
ユーザー okkuukenken
提出日時 2019-02-16 15:11:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 70,096 KB
最終ジャッジ日時 2025-01-06 21:10:25
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int n, a[1000];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int ans = 1e9;
	for (int i = 0; i < n - 1; i++)
		ans = min(ans, a[i + 1] - a[i]);
	cout << ans << endl;
	cout << a[n - 1] - a[0] << endl;
}
0