結果

問題 No.832 麻雀修行中
ユーザー ValkyrjaValkyrja
提出日時 2020-12-09 22:47:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 1,184 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 12,148 KB
実行使用メモリ 10,184 KB
最終ジャッジ日時 2023-10-19 09:07:50
合計ジャッジ時間 2,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,184 KB
testcase_01 AC 30 ms
10,180 KB
testcase_02 AC 31 ms
10,176 KB
testcase_03 AC 30 ms
10,180 KB
testcase_04 AC 30 ms
10,176 KB
testcase_05 AC 32 ms
10,176 KB
testcase_06 AC 32 ms
10,176 KB
testcase_07 AC 32 ms
10,180 KB
testcase_08 AC 32 ms
10,176 KB
testcase_09 AC 31 ms
10,176 KB
testcase_10 AC 31 ms
10,180 KB
testcase_11 AC 31 ms
10,176 KB
testcase_12 AC 31 ms
10,180 KB
testcase_13 AC 31 ms
10,180 KB
testcase_14 AC 31 ms
10,180 KB
testcase_15 AC 31 ms
10,180 KB
testcase_16 AC 31 ms
10,180 KB
testcase_17 AC 32 ms
10,184 KB
testcase_18 AC 32 ms
10,180 KB
testcase_19 AC 32 ms
10,180 KB
testcase_20 AC 31 ms
10,176 KB
testcase_21 AC 33 ms
10,180 KB
testcase_22 AC 31 ms
10,176 KB
testcase_23 AC 30 ms
10,180 KB
testcase_24 AC 31 ms
10,176 KB
testcase_25 AC 31 ms
10,184 KB
testcase_26 AC 30 ms
10,184 KB
testcase_27 AC 32 ms
10,180 KB
testcase_28 AC 31 ms
10,180 KB
testcase_29 AC 31 ms
10,176 KB
testcase_30 AC 30 ms
10,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0