結果

問題 No.825 賢いお買い物
ユーザー titiy
提出日時 2019-05-24 13:50:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-17 10:06:16
合計ジャッジ時間 1,588 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 15 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,c=map(int,input().split())
d=a+b
ans=[]
for A in range(a+1):
    for B in range(b+1):

        if d-A-B==c:
            ans+=[A+B*10]
while a>10:
    a-=10
    b+=1
    d=a+b
    for A in range(a+1):
        for B in range(b+1):
            if d-A-B==c:
                ans+=[A+B*10]
while b>1:
    a+=10
    b-=1
    d=a+b
    for A in range(a+1):
        for B in range(b+1):
            if d-A-B==c:
                ans+=[A+B*10]
if ans==[]:
    print("Impossible")
    exit()
if max(ans)>0:

    print(min(ans))

else:
    print("Impossible")
0