結果

問題 No.825 賢いお買い物
ユーザー _KingdomOfMoray
提出日時 2019-12-25 08:07:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-24 10:47:31
合計ジャッジ時間 1,921 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = list(map(int,input().split()))

candidate = []
for i in range(a+1):
    for j in range(b+1):
        output = 1 * i + 10 * j
        for price in range(1, output+1):
            num_coins = (output - price) // 10 + (output - price) % 10
            if num_coins + (a-i) + (b-j) == c:
                candidate.append(price)
                
if len(candidate) == 0:
    print('Impossible')
else:
    print(min(candidate))
0