結果
| 問題 |
No.185 和風
|
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-18 16:42:09 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 412 bytes |
| コンパイル時間 | 427 ms |
| コンパイル使用メモリ | 25,472 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-18 16:42:10 |
| 合計ジャッジ時間 | 1,156 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
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){
for(int i = 1 ; i < n ; i++ ){
if(resultList[i] <= 0 || resultList[i] != x){
x = -1;
break;
}
}
}else{
x = -1;
}
printf("%d",x);
}
Maeda