結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2025-03-18 16:34:01 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 442 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 25,600 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-18 16:34:03 |
合計ジャッジ時間 | 1,324 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d %d",&numA,&numB); | ^~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> void main(void) { int n = 0; scanf("%d",&n); int numA,numB; int resultList[n]; for(int i = 0 ; i < n ; i++ ){ scanf("%d %d",&numA,&numB); resultList[i] = numB - numA; } int x = resultList[0]; if(x >= 0 && x <= n){ for(int i = 1 ; i < n ; i++ ){ if(resultList[i] < 0 || resultList[i] > n && resultList[i] != x){ x = -1; break; } } }else{ x = -1; } printf("%d",x); }