結果

問題 No.11 カードマッチ
ユーザー HimatsubushinHimatsubushin
提出日時 2022-12-17 11:42:38
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 781 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-28 07:05:47
合計ジャッジ時間 3,173 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 RE -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int main(void) {
	long w, h, n, s, k, a, b, c;
	int sum = 0;
	int card[100][100];

	scanf("%d", &w);
	scanf("%d", &h);
	scanf("%d", &n);

	for (b = 0; b < w; b++)
		for (c = 0; c < h; c++)
			card[b][c] = 0;

	for (a = 0; a < n; a++) {
		scanf("%d %d", &s, &k);
		for (b = 0; b < w; b++) {
			for (c = 0; c < h; c++) {
				if (b == s - 1 && c == k - 1)
					card[b][c] = 2;
				else if (card[b][c] != 2) {
					if (b == s - 1 && c != k - 1)
						card[b][c] = 1;
					if (b != s - 1 && c == k - 1)
						card[b][c] = 1;
				}
			}
		}
	}

	for (c = 0; c < h; c++) {
		for (b = 0; b < w; b++) {
			if (card[b][c] == 1)
				sum += card[b][c];
			printf("%d ", card[b][c]);
		}
		printf("\n");
	}

	printf("%d\n", sum);

	return EXIT_SUCCESS;
}
0