結果

問題 No.832 麻雀修行中
ユーザー akitsugu777
提出日時 2019-09-03 15:16:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 885 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-12-24 03:29:55
合計ジャッジ時間 2,208 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(l):
    if max(l) < 5:
        if l.count(2) == 7:
            return True
    
        for i in range(1, 10):
            l2 = l[:]
            if l2[i] >= 3:
                l2[i] -= 3
                if check(l2):
                    return True
                l2[i] += 3
        
        for i in range(1, 8):
            if l2[i] and l2[i+1] and l2[i+2]:
                l2[i] -= 1
                l2[i+1] -= 1
                l2[i+2] -= 1
                if check(l2):
                    return True
                l2[i] += 1
                l2[i+1] += 1
                l2[i+2] += 1
        
            if sum(l2) == 2 and max(l2) == 2:
                return True


s = list(map(int,input()))

for i in range(1, 10):
    t = s[:]
    t = t + [i]
    
    l = [0] * 10
    for i in t:
        l[i] += 1
    # print(l)
    
    if check(l) == True:
        print(i)
0