結果
| 問題 | No.716 距離 | 
| コンテスト | |
| ユーザー |  dgd1724 | 
| 提出日時 | 2018-11-24 20:52:39 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 531 bytes | 
| コンパイル時間 | 627 ms | 
| コンパイル使用メモリ | 56,972 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-24 19:24:59 | 
| 合計ジャッジ時間 | 1,676 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 40 | 
ソースコード
#include <fstream>
#include <iostream>
int main() {
	//std::ifstream inf("Text.txt");	std::cin.rdbuf(inf.rdbuf());
	int N = 0;
	std::cin >> N;
	int a[1000] = { 0 };
	int min = 0;
	int max = 0;
	int length = 200000;
	std::cin >> a[0];
	min = max = a[0];
	for (int i = 1; i < N; i++) {
		std::cin >> a[i];
		if (a[i] < min) { min = a[i]; }
		if (a[i] > max) { max = a[i]; }
		if (a[i] - a[i - 1] < length) { length = a[i] - a[i - 1]; }
	}
	std::cout << length << std::endl;
	std::cout << max - min << std::endl;
	return 0;
}
            
            
            
        