結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-18 00:20:31 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 330 bytes |
| コンパイル時間 | 219 ms |
| コンパイル使用メモリ | 20,608 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 11:50:49 |
| 合計ジャッジ時間 | 1,476 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 WA * 15 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%ld", &n);
| ^~~~~~~~~~~~~~~~
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%ld", &x);
| ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
long n, x, t, m = 100000000;
scanf("%ld", &n);
for(; n > 0; n--){
scanf("%ld", &x);
if(t - x < m && t - x > 0)
m = t - x;
else if(x - t < m && x - t > 0)
m = x - t;
t = x;
}
if(m == 100000000)
printf("0\n");
else
printf("%ld\n", m);
return 0;
}