結果
問題 | No.267 トランプソート |
ユーザー | Theta |
提出日時 | 2022-10-24 14:35:25 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 28 ms / 1,000 ms |
コード長 | 2,085 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-07-02 17:09:14 |
合計ジャッジ時間 | 1,446 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
11,008 KB |
testcase_01 | AC | 25 ms
10,752 KB |
testcase_02 | AC | 27 ms
10,880 KB |
testcase_03 | AC | 28 ms
10,880 KB |
testcase_04 | AC | 28 ms
10,880 KB |
testcase_05 | AC | 28 ms
10,752 KB |
testcase_06 | AC | 26 ms
10,880 KB |
testcase_07 | AC | 26 ms
10,880 KB |
testcase_08 | AC | 26 ms
10,880 KB |
testcase_09 | AC | 27 ms
10,880 KB |
testcase_10 | AC | 26 ms
10,880 KB |
testcase_11 | AC | 28 ms
11,008 KB |
testcase_12 | AC | 26 ms
11,008 KB |
testcase_13 | AC | 25 ms
11,008 KB |
testcase_14 | AC | 25 ms
10,880 KB |
testcase_15 | AC | 27 ms
10,880 KB |
testcase_16 | AC | 26 ms
10,880 KB |
testcase_17 | AC | 27 ms
10,880 KB |
testcase_18 | AC | 27 ms
11,008 KB |
testcase_19 | AC | 26 ms
10,880 KB |
testcase_20 | AC | 26 ms
10,880 KB |
testcase_21 | AC | 27 ms
10,880 KB |
testcase_22 | AC | 27 ms
10,880 KB |
ソースコード
from enum import IntEnum class Suit(IntEnum): diamond = 1 clover = 2 heart = 3 spade = 4 @classmethod def factory(cls, suit: str): match suit: case "D": return cls.diamond case "C": return cls.clover case "H": return cls.heart case "S": return cls.spade def suit_abb(self): match self: case 1: return "D" case 2: return "C" case 3: return "H" case 4: return "S" class Card: def __init__(self, card: str) -> None: self.suit = Suit.factory(card[0]) match card[1]: case "T": self.number = 10 case "J": self.number = 11 case "Q": self.number = 12 case "K": self.number = 13 case "A": self.number = 1 case other_num: self.number = int(other_num) def str_num(self) -> str: match self.number: case 1: return "A" case 10: return "T" case 11: return "J" case 12: return "Q" case 13: return "K" case other_num: return str(other_num) def __eq__(self, __o: object) -> bool: return self.suit == __o.suit and self.number == __o.number def __ne__(self, __o: object) -> bool: return not self.__eq__(__o) def __lt__(self, __o) -> bool: if self.suit < __o.suit: return True if self.suit == __o.suit: return self.number < __o.number return False def __str__(self) -> str: return self.suit.suit_abb() + self.str_num() def main(): input() cards = list(map(Card, input().split())) cards.sort() print(*cards) if __name__ == "__main__": main()