結果
問題 | No.267 トランプソート |
ユーザー | jp_ste |
提出日時 | 2016-05-11 16:01:02 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 182 ms / 1,000 ms |
コード長 | 1,725 bytes |
コンパイル時間 | 4,329 ms |
コンパイル使用メモリ | 87,084 KB |
実行使用メモリ | 42,728 KB |
最終ジャッジ日時 | 2024-04-15 15:09:55 |
合計ジャッジ時間 | 8,759 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 154 ms
42,524 KB |
testcase_01 | AC | 161 ms
42,724 KB |
testcase_02 | AC | 156 ms
42,264 KB |
testcase_03 | AC | 143 ms
42,064 KB |
testcase_04 | AC | 158 ms
42,188 KB |
testcase_05 | AC | 142 ms
41,996 KB |
testcase_06 | AC | 159 ms
42,552 KB |
testcase_07 | AC | 143 ms
42,144 KB |
testcase_08 | AC | 176 ms
42,264 KB |
testcase_09 | AC | 174 ms
42,592 KB |
testcase_10 | AC | 182 ms
42,728 KB |
testcase_11 | AC | 165 ms
42,356 KB |
testcase_12 | AC | 178 ms
42,368 KB |
testcase_13 | AC | 178 ms
42,488 KB |
testcase_14 | AC | 166 ms
42,596 KB |
testcase_15 | AC | 167 ms
42,616 KB |
testcase_16 | AC | 157 ms
41,824 KB |
testcase_17 | AC | 168 ms
42,260 KB |
testcase_18 | AC | 175 ms
42,452 KB |
testcase_19 | AC | 166 ms
42,364 KB |
testcase_20 | AC | 167 ms
42,724 KB |
testcase_21 | AC | 167 ms
42,628 KB |
testcase_22 | AC | 164 ms
42,724 KB |
ソースコード
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main2 { public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { int n = Integer.parseInt(scan.next()); ArrayList<String> list = new ArrayList<>(); for(int i=0; i<n; i++) { char ch[] = scan.next().toCharArray(); if(ch[0] == 'D') ch[0] = '0'; else if(ch[0] == 'C') ch[0] = '1'; else if(ch[0] == 'H') ch[0] = '2'; else if(ch[0] == 'S') ch[0] = '3'; if(ch[1] == 'A') ch[1] = '1'; else if(ch[1] == 'T') ch[1] = 'A'; else if(ch[1] == 'J') ch[1] = 'B'; else if(ch[1] == 'Q') ch[1] = 'C'; else if(ch[1] == 'K') ch[1] = 'D'; list.add("" + ch[0] + ch[1]); } Collections.sort(list); for(int i=0; i<list.size(); i++) { if(i > 0) System.out.print(" "); char f = list.get(i).charAt(0); if(f == '0') f = 'D'; else if(f == '1') f = 'C'; else if(f == '2') f = 'H'; else if(f == '3') f = 'S'; char l = list.get(i).charAt(1); if(l == '1') l = 'A'; else if(l == 'A') l = 'T'; else if(l == 'B') l = 'J'; else if(l == 'C') l = 'Q'; else if(l == 'D') l = 'K'; System.out.print("" + f + l); } } } }