結果

問題 No.832 麻雀修行中
ユーザー simamumu
提出日時 2019-05-24 21:46:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 1,186 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-09-17 10:33:24
合計ジャッジ時間 2,414 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

S = list(map(int,list(input())))
cnt = [0]*10
ans = []

for s in S:
    cnt[s] += 1

# 七対子
if cnt.count(2) == 6:
    ans.append(cnt.index(1))

def dfs1 (te):
    a = te[0]
    if te.count(a) >= 3:
        for i in range(3):
            te.remove(a)
        if len(te) == 0:
            return True
        return dfs1(te)
    elif (a+1 in te) and (a+2 in te):
        for i in range(3):
            te.remove(a+i)
        if len(te) == 0:
            return True
        return dfs1(te)
    else:
        return False


for x in range(1,10):
    if cnt[x] >= 4:
        continue
    tmpS = S + [x]
    tmpS.sort()
    # 単騎待ち
    for atama in range(1,10):
        if tmpS.count(atama) <= 1:
            continue
        nowS = tmpS[:]
        nowS.remove(atama)
        nowS.remove(atama)
        if dfs1(nowS):
            ans.append(x)

ans = list(set(ans))
ans.sort()
for a in ans:
    print(a)
0