結果

問題 No.267 トランプソート
ユーザー FF256grhyFF256grhy
提出日時 2015-08-21 22:58:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,065 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 26,548 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 15:08:46
合計ジャッジ時間 1,162 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:20: warning: ‘m1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   memo[m1][m2 - 1] = 1;
   ~~~~~~~~~~~~~~~~~^~~

ソースコード

diff #

#include <stdio.h>

int n, memo[4][13];
char c1, c2, cx;

int main(void) {
	scanf("%d", &n);
	
	int i, j;
	for(i = 0; i < n; i++) {
		scanf("%c%c%c", &cx, &c1, &c2);
		int m1, m2;
		switch(c1) {
			case 'D': m1 = 0; break;
			case 'C': m1 = 1; break;
			case 'H': m1 = 2; break;
			case 'S': m1 = 3; break;
		}
		switch(c2) {
			case 'A': m2 =  1; break;
			case 'T': m2 = 10; break;
			case 'J': m2 = 11; break;
			case 'Q': m2 = 12; break;
			case 'K': m2 = 13; break;
			default:  m2 = c2 - '0';
		}
		memo[m1][m2 - 1] = 1;
	}
	
	int flag = 0;
	for(i = 0; i < 4; i++) {
		switch(i) {
			case 0: c1 = 'D'; break;
			case 1: c1 = 'C'; break;
			case 2: c1 = 'H'; break;
			case 3: c1 = 'S'; break;
		}
		for(j = 0; j < 13; j++) {
			if(memo[i][j]) {
				switch(j) {
					case  0: c2 = 'A'; break;
					case  9: c2 = 'T'; break;
					case 10: c2 = 'J'; break;
					case 11: c2 = 'Q'; break;
					case 12: c2 = 'K'; break;
					default: c2 = j + 1 + '0';
				}
				printf("%s%c%c", (flag ? " " : ""), c1, c2);
				flag = 1;
			}
		}
	}
	printf("\n");
	
	return 0;
}
0