結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2016-08-24 17:56:52 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 495 bytes |
コンパイル時間 | 382 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 02:06:01 |
合計ジャッジ時間 | 961 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d", &n); | ^~~~~~~~~~~~~~~ main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d %d", &a[0], &b[0]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d %d", &a[i], &b[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main() { int n, a[1000], b[1000], i; long long int max, sum = 0; scanf("%d", &n); scanf("%d %d", &a[0], &b[0]); max = a[0] + b[0] * 4; for (i = 1; i < n; i++) { scanf("%d %d", &a[i], &b[i]); if ((a[i] + b[i] * 4) % 2 != (a[i - 1] + b[i - 1] * 4) % 2) { printf("-1\n"); return 0; } if (max < a[i] + b[i] * 4) max = a[i] + b[i] * 4; } for (i = 0; i < n; i++) { sum += (max - (a[i] + b[i] * 4)) / 2; } printf("%lld\n", sum); return 0; }