結果

問題 No.178 美しいWhitespace (1)
ユーザー くれちーくれちー
提出日時 2016-08-24 17:55:00
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-25 15:06:25
合計ジャッジ時間 992 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 0 ms
6,940 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 0 ms
6,940 KB
testcase_12 AC 0 ms
6,944 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 0 ms
6,940 KB
testcase_19 WA -
testcase_20 AC 1 ms
6,944 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d %d", &a[0], &b[0]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d %d", &a[i], &b[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main() {
	int n, a[1000], b[1000], max, sum = 0, i;

	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("%d\n", sum);

	return 0;
}
0