結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
![]() |
提出日時 | 2015-06-03 10:30:49 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 395 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 13:52:45 |
合計ジャッジ時間 | 947 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:9:25: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long long int *’ [-Wformat=] 9 | scanf("%d%d", &a[i], &b[i]); | ~^ ~~~~~ | | | | int * long long int * | %lld main.c:9:27: warning: format ‘%d’ expects argument of type ‘int *’, but argument 3 has type ‘long long int *’ [-Wformat=] 9 | scanf("%d%d", &a[i], &b[i]); | ~^ ~~~~~ | | | | int * long long int * | %lld main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d", &N); | ^~~~~~~~~~~~~~~ main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d%d", &a[i], &b[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { int i, N; long long int a[1001], b[1001], c[1001], max, sum; scanf("%d", &N); max = 0; for(i = 1;i <= N;i++){ scanf("%d%d", &a[i], &b[i]); c[i] = a[i] + 4 * b[i]; if(c[i] > max)max = c[i]; } sum = 0; for(i = 1;i <= N;i++){ sum += max - c[i]; } if(sum % 2 == 0){ printf("%lld\n", sum / 2); } else{ printf("-1\n"); } return 0; }