結果

問題 No.267 トランプソート
ユーザー GrenacheGrenache
提出日時 2015-08-21 22:30:32
言語 Java19
(openjdk 21)
結果
AC  
実行時間 140 ms / 1,000 ms
コード長 1,270 bytes
コンパイル時間 3,338 ms
コンパイル使用メモリ 74,332 KB
実行使用メモリ 56,268 KB
最終ジャッジ日時 2023-09-25 14:46:54
合計ジャッジ時間 7,636 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,056 KB
testcase_01 AC 124 ms
55,872 KB
testcase_02 AC 122 ms
55,780 KB
testcase_03 AC 122 ms
54,012 KB
testcase_04 AC 124 ms
55,516 KB
testcase_05 AC 123 ms
56,208 KB
testcase_06 AC 123 ms
55,552 KB
testcase_07 AC 124 ms
55,792 KB
testcase_08 AC 140 ms
56,100 KB
testcase_09 AC 140 ms
55,732 KB
testcase_10 AC 140 ms
55,928 KB
testcase_11 AC 137 ms
55,772 KB
testcase_12 AC 137 ms
55,724 KB
testcase_13 AC 139 ms
55,872 KB
testcase_14 AC 136 ms
56,104 KB
testcase_15 AC 138 ms
56,268 KB
testcase_16 AC 140 ms
55,812 KB
testcase_17 AC 140 ms
55,684 KB
testcase_18 AC 139 ms
55,784 KB
testcase_19 AC 139 ms
56,116 KB
testcase_20 AC 138 ms
53,948 KB
testcase_21 AC 139 ms
56,056 KB
testcase_22 AC 139 ms
55,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder267 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        boolean[][] cards = new boolean[4][13];
        char[] mmm = {'D', 'C', 'H', 'S'};
        char[] nnn = {'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K'};
        for (int i = 0; i < n; i++) {
        	char[] mn = sc.next().toCharArray();
        	int mm, nn;
        	if (mn[0] == 'D') {
        		mm = 0;
        	} else if (mn[0] == 'C') {
        		mm = 1;
        	} else if (mn[0] == 'H') {
        		mm = 2;
        	} else {
        		mm = 3;
        	}

        	if (mn[1] == 'A') {
        		nn = 0;
        	} else if (mn[1] == 'T') {
        		nn = 9;
        	} else if (mn[1] == 'J') {
        		nn = 10;
        	} else if (mn[1] == 'Q') {
        		nn = 11;
        	} else if (mn[1] == 'K') {
        		nn = 12;
        	} else {
        		nn = mn[1] - '1';
        	}
        	
        	cards[mm][nn] = true;
        }

        for (int i = 0; i < 4; i++) {
        	for (int j = 0; j < 13; j++) {
        		if (cards[i][j]) {
        			System.out.printf("%c%c ", mmm[i], nnn[j]);
        		}
        	}
        }

        sc.close();
    }
}
0