結果

問題 No.267 トランプソート
ユーザー tsunabittsunabit
提出日時 2020-03-19 17:51:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 175 ms / 1,000 ms
コード長 1,271 bytes
コンパイル時間 3,882 ms
コンパイル使用メモリ 76,184 KB
実行使用メモリ 57,036 KB
最終ジャッジ日時 2023-08-20 20:59:30
合計ジャッジ時間 8,997 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
54,652 KB
testcase_01 AC 128 ms
55,952 KB
testcase_02 AC 163 ms
56,912 KB
testcase_03 AC 163 ms
56,628 KB
testcase_04 AC 162 ms
56,824 KB
testcase_05 AC 129 ms
55,716 KB
testcase_06 AC 163 ms
56,588 KB
testcase_07 AC 130 ms
55,712 KB
testcase_08 AC 173 ms
56,788 KB
testcase_09 AC 173 ms
56,668 KB
testcase_10 AC 173 ms
56,600 KB
testcase_11 AC 171 ms
56,924 KB
testcase_12 AC 172 ms
56,748 KB
testcase_13 AC 173 ms
56,972 KB
testcase_14 AC 172 ms
56,672 KB
testcase_15 AC 173 ms
57,036 KB
testcase_16 AC 171 ms
56,976 KB
testcase_17 AC 175 ms
54,732 KB
testcase_18 AC 175 ms
56,484 KB
testcase_19 AC 174 ms
56,712 KB
testcase_20 AC 172 ms
56,676 KB
testcase_21 AC 171 ms
56,716 KB
testcase_22 AC 170 ms
56,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No247 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] d = new char[14];
		char[] c = new char[14];
		char[] h = new char[14];
		char[] s = new char[14];
		
		for(int i = 0; i < n; i++) {
			String t = sc.next();
			int y;
			if(t.charAt(1) == 'A') y=1;
			else if(t.charAt(1) == 'T') y=10;
			else if(t.charAt(1) == 'J') y=11;
			else if(t.charAt(1) == 'Q') y=12;
			else if(t.charAt(1) == 'K') y=13;
			else y=Integer.parseInt(t.substring(1));
			
			if(t.charAt(0) == 'D') d[y] = 't';
			else if(t.charAt(0) == 'C') c[y] = 't';
			else if(t.charAt(0) == 'H') h[y] = 't';
			else if(t.charAt(0) == 'S') s[y] = 't';
		}
		re("D", d);
		re("C", c);
		re("H", h);
		re("S", s);
		System.out.println("");
	}
	public static void re(String k, char[] a) {
		for(int i = 0; i < a.length; i++) {
			if(a[i] == 't') {
				if(i == 1) System.out.print(k + "A" + " ");
				else if(i == 10) System.out.print(k + "T" + " ");
				else if(i == 11) System.out.print(k + "J" + " ");
				else if(i == 12) System.out.print(k + "Q" + " ");
				else if(i == 13) System.out.print(k + "K" + " ");
				else System.out.print(k + i + " ");
				
			}
		}
	}
}
0