結果
問題 | No.267 トランプソート |
ユーザー |
![]() |
提出日時 | 2021-12-23 21:55:50 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 505 bytes |
コンパイル時間 | 2,449 ms |
コンパイル使用メモリ | 213,184 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 13:52:14 |
合計ジャッジ時間 | 3,427 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
import std; void main() { int N; readf("%d\n", N); auto cards = readln.chomp.split; string suit = "DCHS"; string num = "A123456789TJQK"; bool myCmp(string a, string b) { if (a[0] == b[0]) { return indexOf(num, a[1]) < indexOf(num, b[1]); } else { return indexOf(suit, a[0]) < indexOf(suit, b[0]); } } cards.sort!myCmp; foreach (i, c; cards) { c.write; write(i == N - 1 ? "\n" : " "); } }