結果

問題 No.825 賢いお買い物
ユーザー gojoTYgojoTY
提出日時 2019-05-26 02:30:54
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 502 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 11,960 KB
実行使用メモリ 10,172 KB
最終ジャッジ日時 2023-10-17 17:48:24
合計ジャッジ時間 1,581 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,984 KB
testcase_01 WA -
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 30 ms
9,984 KB
testcase_04 AC 29 ms
9,984 KB
testcase_05 WA -
testcase_06 AC 30 ms
9,984 KB
testcase_07 AC 28 ms
9,984 KB
testcase_08 AC 28 ms
9,984 KB
testcase_09 AC 28 ms
9,984 KB
testcase_10 AC 28 ms
9,984 KB
testcase_11 AC 28 ms
9,984 KB
testcase_12 AC 28 ms
9,984 KB
testcase_13 AC 29 ms
9,984 KB
testcase_14 AC 28 ms
9,984 KB
testcase_15 AC 28 ms
9,984 KB
testcase_16 AC 28 ms
9,984 KB
testcase_17 AC 27 ms
9,984 KB
testcase_18 AC 27 ms
9,984 KB
testcase_19 AC 28 ms
9,984 KB
testcase_20 AC 28 ms
9,984 KB
testcase_21 AC 28 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x, y, z = map(int, input().split())
sum = x + 10 * y
y_10, x_10 = divmod(sum, 10)
if x == z and y ==0:
    print('Impossible')
    exit()
if y == 0:
    if x < z:
        print('Impossible')
        exit()
elif x + y + 10 < z:
    print('Impossible')
    exit()
if y_10>z:
    print((y-z) * 10 + x)
elif x_10>x_10+y_10-z:
    print(x_10+y_10-z)
    exit()
else:
    change_count = (z-y_10)//9
    if change_count == 0:
        change_count = 1
    print(y_10 - change_count + x_10 + change_count*10-z)
0