結果

問題 No.825 賢いお買い物
ユーザー titiatitia
提出日時 2019-05-03 21:29:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 7,956 KB
最終ジャッジ日時 2023-08-30 05:56:16
合計ジャッジ時間 1,694 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
7,824 KB
testcase_01 AC 61 ms
7,884 KB
testcase_02 AC 22 ms
7,852 KB
testcase_03 AC 18 ms
7,828 KB
testcase_04 AC 24 ms
7,788 KB
testcase_05 AC 31 ms
7,876 KB
testcase_06 AC 16 ms
7,904 KB
testcase_07 AC 17 ms
7,808 KB
testcase_08 AC 41 ms
7,884 KB
testcase_09 AC 17 ms
7,956 KB
testcase_10 AC 27 ms
7,828 KB
testcase_11 AC 38 ms
7,816 KB
testcase_12 AC 22 ms
7,824 KB
testcase_13 AC 16 ms
7,820 KB
testcase_14 AC 18 ms
7,896 KB
testcase_15 AC 30 ms
7,892 KB
testcase_16 AC 35 ms
7,956 KB
testcase_17 AC 17 ms
7,824 KB
testcase_18 AC 39 ms
7,912 KB
testcase_19 AC 21 ms
7,836 KB
testcase_20 AC 17 ms
7,780 KB
testcase_21 AC 17 ms
7,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B,C=map(int,input().split())

def rest(i,j,money):
    otsuri=i+10*j-money

    return otsuri//10+otsuri%10

ANS=[]
for i in range(A+1):
    for j in range(B+1):
        if i+j==0:
            continue

        for money in range(1,i+10*B+1):
            otsuri=rest(i,j,money)
            if otsuri+(A-i)+(B-j)==C:
                ANS.append(money)


if len(ANS)>0:
    print(min(ANS))
else:
    print("Impossible")
0