結果

問題 No.825 賢いお買い物
ユーザー URechaRechaURechaRecha
提出日時 2019-09-03 09:52:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-08-24 23:32:28
合計ジャッジ時間 1,400 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,752 KB
testcase_01 AC 17 ms
7,796 KB
testcase_02 AC 15 ms
7,756 KB
testcase_03 AC 15 ms
7,760 KB
testcase_04 AC 16 ms
7,920 KB
testcase_05 AC 16 ms
7,812 KB
testcase_06 AC 15 ms
7,972 KB
testcase_07 AC 15 ms
7,756 KB
testcase_08 AC 16 ms
7,812 KB
testcase_09 AC 15 ms
7,920 KB
testcase_10 AC 15 ms
7,816 KB
testcase_11 AC 16 ms
7,804 KB
testcase_12 AC 15 ms
7,864 KB
testcase_13 AC 15 ms
7,752 KB
testcase_14 AC 16 ms
7,848 KB
testcase_15 AC 15 ms
7,832 KB
testcase_16 AC 15 ms
7,812 KB
testcase_17 AC 15 ms
7,848 KB
testcase_18 AC 15 ms
7,756 KB
testcase_19 AC 16 ms
7,804 KB
testcase_20 AC 16 ms
7,852 KB
testcase_21 AC 16 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def func(n1:int,n10:int,r:int):
    a,b =n1,n10
    if n1 + n10 <= r:
        if n10 >= 1 and n1+9 + n10-1 >= r:
            n1 +=10
            n10 -=1
        else:return "Impossible"
    p1,p10 =0,0
    while n1+n10-r >0:
        if n1>0:
            n1 -= 1
            p1 += 1
        else:
            if n10>0:
                n10 -= 1
                p10 += 1
    #釣りを受け取れる場合
    while n1 > 1 and p1 >= 10:
        n1 -=1
        p1 +=1
        p1 -=10
        n10 +=1
    ans = a+b*10 - (n1 + n10 *10)
    return ans

a,b,c = map(int,input().split())
print(func(a,b,c))
0