結果

問題 No.825 賢いお買い物
ユーザー hiragnhiragn
提出日時 2022-11-12 22:24:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 8,240 KB
最終ジャッジ日時 2023-10-12 11:55:40
合計ジャッジ時間 1,727 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,164 KB
testcase_01 AC 17 ms
8,084 KB
testcase_02 AC 19 ms
7,932 KB
testcase_03 AC 17 ms
7,836 KB
testcase_04 AC 17 ms
7,924 KB
testcase_05 AC 15 ms
8,240 KB
testcase_06 AC 15 ms
7,872 KB
testcase_07 AC 15 ms
7,824 KB
testcase_08 AC 21 ms
8,200 KB
testcase_09 AC 16 ms
7,852 KB
testcase_10 AC 19 ms
7,752 KB
testcase_11 AC 21 ms
8,224 KB
testcase_12 AC 15 ms
8,080 KB
testcase_13 AC 16 ms
7,828 KB
testcase_14 AC 16 ms
8,076 KB
testcase_15 AC 19 ms
8,224 KB
testcase_16 AC 19 ms
8,116 KB
testcase_17 AC 15 ms
8,100 KB
testcase_18 AC 21 ms
8,164 KB
testcase_19 AC 17 ms
8,120 KB
testcase_20 AC 16 ms
8,208 KB
testcase_21 AC 15 ms
8,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    a, b, c = map(int, input().split())

    for price in range(1, a + 10 * b + 1):
        # 1Gコインをx枚,10Gコインをy枚使って払う
        for x in range(a + 1):
            for y in range(b + 1):
                pay = x + 10 * y
                if pay < price:
                    continue
                # お釣り
                back = pay - price
                if c == a - x + b - y + back % 10 + back // 10:
                    print(price)
                    exit()
    print("Impossible")


if __name__ == "__main__":
    main()
0