結果
問題 | No.832 麻雀修行中 |
ユーザー |
![]() |
提出日時 | 2019-05-24 22:21:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 794 bytes |
コンパイル時間 | 188 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-17 10:55:28 |
合計ジャッジ時間 | 2,036 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 25 |
ソースコード
from collections import Counterdef check(c: Counter):for i in range(1, 10):if c[i] >= 3:c2 = c.copy()c2[i] -= 3if check(c2):return Trueif c[i] and c[i+1] and c[i+2]:c2 = c.copy()c2[i] -= 1c2[i+1] -= 1c2[i+2] -= 1if check(c2):return Truereturn c.most_common(2)[0][1] == 2 and c.most_common(2)[1][1] == 0def solve():counter = Counter(map(int, input()))for i in range(1, 10):if counter[i] == 4:continuecounter[i] += 1if all(v == 2 for v in counter.values() if v) or check(counter.copy()):print(i)counter[i] -= 1if __name__ == "__main__":solve()