結果

問題 No.1156 Nada Picnic 2
ユーザー neko_the_shadowneko_the_shadow
提出日時 2020-08-25 13:20:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,074 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 75,776 KB
最終ジャッジ日時 2024-04-24 04:23:42
合計ジャッジ時間 1,199 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
75,136 KB
testcase_01 AC 135 ms
75,392 KB
testcase_02 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n = int(input())
if n == 1:
    for a, b, c, d, e, f, g, h in itertools.permutations(range(10), r=8):
        if b == 0:
            continue
        x =          100*a + 10*b + c
        y =          100*d + 10*e + f
        z = 1000*b + 100*g + 10*h + b
        if x+y == z:
            print(z)
            exit(0)

if n == 2:
    for a, b, c, d, e, f, g, h, i, j in itertools.permutations(range(10)):
        if a == 0 or d == 0 or h == 0:
            continue
        x =           1000*a + 100*a + 10*b + c
        y =           1000*d + 100*e + 10*f + g
        z = 10000*h + 1000*i + 100*b + 10*c + j
        if x+y == z:
            print(z)
            exit(0)

if n == 3:
    for c, e, g, h, i, n, p, r, s, t in itertools.permutations(range(10)):
        if s == 0 or e == 0 or p == 0:
            continue
        x =            10000*s + 1000*p + 100*r + 10*i + g
        y =            10000*e + 1000*i + 100*g + 10*h + t
        z = 100000*p + 10000*i + 1000*c + 100*n + 10*i + c
        if x+y == z:
            print(z)
            exit(0)
0