結果

問題 No.832 麻雀修行中
ユーザー stngstng
提出日時 2022-07-10 12:54:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,498 bytes
コンパイル時間 1,039 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 78,404 KB
最終ジャッジ日時 2023-08-30 23:38:38
合計ジャッジ時間 5,425 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
77,984 KB
testcase_01 AC 93 ms
76,308 KB
testcase_02 AC 91 ms
76,688 KB
testcase_03 AC 91 ms
76,884 KB
testcase_04 AC 100 ms
76,752 KB
testcase_05 AC 95 ms
76,876 KB
testcase_06 AC 97 ms
76,980 KB
testcase_07 AC 96 ms
76,632 KB
testcase_08 AC 97 ms
76,956 KB
testcase_09 AC 95 ms
77,116 KB
testcase_10 AC 94 ms
76,796 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 106 ms
77,560 KB
testcase_14 WA -
testcase_15 AC 110 ms
78,144 KB
testcase_16 AC 115 ms
77,740 KB
testcase_17 AC 113 ms
77,584 KB
testcase_18 AC 103 ms
77,764 KB
testcase_19 AC 103 ms
77,400 KB
testcase_20 AC 94 ms
76,924 KB
testcase_21 WA -
testcase_22 AC 118 ms
77,992 KB
testcase_23 WA -
testcase_24 AC 98 ms
76,716 KB
testcase_25 AC 100 ms
76,700 KB
testcase_26 AC 112 ms
77,948 KB
testcase_27 AC 92 ms
76,452 KB
testcase_28 AC 121 ms
78,316 KB
testcase_29 AC 88 ms
76,784 KB
testcase_30 AC 100 ms
76,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)

s = input()
li = [0]*10
for i in range(len(s)):
    li[int(s[i])] += 1

s = li[:]

num = 2**4
ans = set()
for i in range(1,10):
    if s[i] == 4:
        continue
    s[i] += 1
    ori = s[:]
    f = True
    for j in range(10):
        if s[j] != 0 and s[j] != 2:
            f = False
           
    if f == True:
        ans.add(i)
        continue

    for j in range(1,10):
        s = ori[:]
        if s[j] >= 2:
            s[j] -= 2
        else:
            continue
        ori2 = s[:]
        for k in range(num):
            s = ori2[:]
            tmp = str(base10to(k,2)).zfill(4)
            for l in range(4):
                if tmp[l] == "0":
                    for m in range(1,10):
                        if s[m] >= 3:
                            s[m] -= 3
                            break
                if tmp[l] == "1":
                    for m in range(1,8):
                        if s[m] >= 1 and s[m+1] >= 1 and s[m+2] >= 1:
                            s[m] -= 1
                            s[m+1] -= 1
                            s[m+2] -= 1
                #if tmp[l] == "2":
                #    for m in range(3,10):
                #        if s[m-2] >= 1 and s[m-1] >= 1 and s[m]

            if sum(s) == 0:
                ans.add(i)
                break

    s = li[:]

ans = list(ans)
ans.sort()
for i in range(len(ans)):
    print(ans[i])





0