結果
問題 |
No.267 トランプソート
|
ユーザー |
|
提出日時 | 2020-03-19 17:51:07 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 188 ms / 1,000 ms |
コード長 | 1,271 bytes |
コンパイル時間 | 4,376 ms |
コンパイル使用メモリ | 80,684 KB |
実行使用メモリ | 55,272 KB |
最終ジャッジ日時 | 2024-12-14 03:22:33 |
合計ジャッジ時間 | 8,809 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
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 + " "); } } } }