結果

問題 No.267 トランプソート
ユーザー FF256grhyFF256grhy
提出日時 2015-08-21 22:50:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,143 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 26,592 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-25 15:03:43
合計ジャッジ時間 1,194 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29: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);
		printf("  test  : %c%c \n", 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 = c1 - '0';
		}
		printf("  mmmm  : %d%d \n", m1, m2);
		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("%c%c%c", (flag ? " " : ""), c1, c2);
				flag = 1;
			}
		}
	}
	printf("\n");
	
	return 0;
}
0