結果
問題 | 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 Counter def check(c: Counter): for i in range(1, 10): if c[i] >= 3: c2 = c.copy() c2[i] -= 3 if check(c2): return True if c[i] and c[i+1] and c[i+2]: c2 = c.copy() c2[i] -= 1 c2[i+1] -= 1 c2[i+2] -= 1 if check(c2): return True return c.most_common(2)[0][1] == 2 and c.most_common(2)[1][1] == 0 def solve(): counter = Counter(map(int, input())) for i in range(1, 10): if counter[i] == 4: continue counter[i] += 1 if all(v == 2 for v in counter.values() if v) or check(counter.copy()): print(i) counter[i] -= 1 if __name__ == "__main__": solve()