結果
問題 | No.825 賢いお買い物 |
ユーザー | ゆるく |
提出日時 | 2019-05-03 22:12:20 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
WA
|
実行時間 | - |
コード長 | 673 bytes |
コンパイル時間 | 94 ms |
コンパイル使用メモリ | 10,896 KB |
実行使用メモリ | 52,512 KB |
最終ジャッジ日時 | 2023-08-30 06:10:16 |
合計ジャッジ時間 | 4,232 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
14,732 KB |
testcase_01 | AC | 31 ms
10,312 KB |
testcase_02 | AC | 32 ms
10,272 KB |
testcase_03 | AC | 31 ms
10,300 KB |
testcase_04 | AC | 31 ms
10,292 KB |
testcase_05 | WA | - |
testcase_06 | AC | 31 ms
10,280 KB |
testcase_07 | AC | 31 ms
10,508 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
ソースコード
# coding: UTF-8 import sys sys.setrecursionlimit(900000) import heapq import re import bisect import random import math import itertools from collections import defaultdict, deque from copy import deepcopy from decimal import * a, b, c = map(int, input().split()) ans = [] def dfs(x, y, pay): if x + y == c: ans.append(pay) if x + y < c: return -1 if y > 0 and y >= c: dfs(x, y - 1, pay + 10) if x >= 10: dfs(x - 10, y + 1, pay) if x > 0: dfs(x - 1, y, pay + 1) return -1 if a + b <= c: print('Impossible') else: dfs(a, b, 0) if ans: print(min(ans)) else: print('Impossible')