結果

問題 No.1156 Nada Picnic 2
ユーザー Maboy
提出日時 2023-02-08 19:35:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 556 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,824 KB
最終ジャッジ日時 2024-07-06 05:45:54
合計ジャッジ時間 6,891 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def ucc(n):
    s = ["シイタ+ケヤマ=イキタイ","オオツカ+コクサイ=ビジツカン","spring+eight=picnic"][n-1]
    key = sorted(set([x for x in s if x not in "+="]))
    r = [x for x in range(10)][::1-(n==2)*2]
    p = itertools.permutations(r)
    for i in p:
        t = s
        for j,k in enumerate(key):
            t = t.replace(k,str(i[j]))
        if "0" not in [t[0],t[t.find("+")+1],t[t.find("=")+1]]:
            if eval(t.replace("=","==")):
                return t[t.find("=")+1:]

print(ucc(int(input())))
0