結果

問題 No.825 賢いお買い物
ユーザー maspy
提出日時 2020-01-27 00:16:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-14 11:35:47
合計ジャッジ時間 1,791 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

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

it = itertools.product(range(1,300), range(A+1), range(B+1))
answer = 'Impossible'
for p,a,b in it:
    # 1円、10円、購入額
    x = a + b * 10 - p
    if x < 0:
        continue
    n = (A-a) + (B-b) + (x//10) + (x%10)
    if n == C:
        answer = p
        break

print(answer)
0