結果

問題 No.1156 Nada Picnic 2
ユーザー brthyyjpbrthyyjp
提出日時 2021-07-07 19:07:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,182 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 76,272 KB
最終ジャッジ日時 2024-07-01 12:23:08
合計ジャッジ時間 1,875 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

import itertools

if n == 1:
    for p in itertools.permutations(range(10), 8):
        a = str(p[0])+str(p[1])+str(p[2])
        b = str(p[3])+str(p[4])+str(p[5])
        c = str(p[1])+str(p[6])+str(p[2])+str(p[7])
        if a[0] == '0' or b[0] == '0' or c[0] == '0':
            continue
        if int(a)+int(b) == int(c):
            print(c)
            exit()
elif n == 2:
    for p in itertools.permutations(range(10), 10):
        a = str(p[0])+str(p[0])+str(p[1])+str(p[2])
        b = str(p[3])+str(p[4])+str(p[5])+str(p[6])
        c = str(p[7])+str(p[8])+str(p[1])+str(p[2])+str(p[9])
        if a[0] == '0' or b[0] == '0' or c[0] == '0':
            continue
        if int(a)+int(b) == int(c):
            print(c)
            exit()
else:
    for p in itertools.permutations(range(10), 10):
        a = str(p[0])+str(p[1])+str(p[2])+str(p[3])+str(p[4])+str(p[5])
        b = str(p[6])+str(p[3])+str(p[5])+str(p[7])+str(p[8])
        c = str(p[1])+str(p[2])+str(p[9])+str(p[4])+str(p[2])+str(p[9])
        if a[0] == '0' or b[0] == '0' or c[0] == '0':
            continue
        if int(a)+int(b) == int(c):
            print(c)
            exit()
0