結果

問題 No.825 賢いお買い物
ユーザー c-yan
提出日時 2020-08-05 01:42:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-15 02:45:19
合計ジャッジ時間 1,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if B == 0:
    if C >= A or A == 0:
        print('Impossible')
    else:
        print(A - C)
else:
    if C >= A + B + 10:
        print('Impossible')
    elif C >= A + B:
        print(A + B + 9 - C)
    else:
        while A >= 10 and (A - 10) + (B + 1) > C:
            B += 1
            A -= 10
        if A + B - C <= A:
            print(A + B - C)
        else:
            print((B - C) * 10 + A)
0