結果
問題 | No.185 和風 |
ユーザー | umashika |
提出日時 | 2016-02-01 21:21:31 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 395 bytes |
コンパイル時間 | 117 ms |
コンパイル使用メモリ | 22,088 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-21 18:33:33 |
合計ジャッジ時間 | 626 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
4,348 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 1 ms
4,348 KB |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:14: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 2 has type ‘long long int *’ [-Wformat=] 10 | scanf("%ld %ld",&x[i],&y[i]); | ~~^ ~~~~~ | | | | | long long int * | long int * | %lld main.c:10:18: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 3 has type ‘long long int *’ [-Wformat=] 10 | scanf("%ld %ld",&x[i],&y[i]); | ~~^ ~~~~~ | | | | | long long int * | long int * | %lld main.c:21:13: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long long int’ [-Wformat=] 21 | printf("%ld\n",difference[0]); | ~~^ ~~~~~~~~~~~~~ | | | | long int long long int | %lld main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:10:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%ld %ld",&x[i],&y[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(void){ int n; int i; scanf("%d",&n); long long int x[n],y[n]; long long int difference[n]; for(i=0;i<n;i++){ scanf("%ld %ld",&x[i],&y[i]); } for(i=0;i<n;i++){ difference[i]=y[i]-x[i]; } for(i=0;i<n-1;i++){ if(difference[i]!=difference[i+1]){ printf("-1\n"); break; } } printf("%ld\n",difference[0]); return 0; }