結果
問題 |
No.832 麻雀修行中
|
ユーザー |
![]() |
提出日時 | 2020-12-09 22:47:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 1,184 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-19 05:20:09 |
合計ジャッジ時間 | 2,102 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 25 |
ソースコード
def rihai(t): l=list(t) l.sort() res="".join(l) return res def janto(t): res=[] for i in range(1,10): l=list(t) if l.count(str(i))>=2: l.remove(str(i)) l.remove(str(i)) p="".join(l) res.append(p) return res from functools import lru_cache @lru_cache(maxsize=10000) def mentsu(t): if t=="": return True if t[0]==t[1] and t[0]==t[2]: l=list(t) l.remove(t[0]) l.remove(t[0]) l.remove(t[0]) t="".join(l) return mentsu(t) if str(int(t[0])+1) in t: if str(int(t[0])+2) in t: l=list(t) l.remove(str(int(l[0])+2)) l.remove(str(int(l[0])+1)) l.remove(l[0]) t="".join(l) return mentsu(t) return False tehai=input() ans=[] for i in range(1,10): t=tehai if t.count(str(i))>=4: continue t=t+str(i) t=rihai(t) l=janto(t) if len(l)==7: ans.append(i) for j in l: if mentsu(j): ans.append(i) tmp=set(ans) ans=list(tmp) ans.sort() for i in ans:print(i)