結果

問題 No.825 賢いお買い物
ユーザー hang_hang_cln
提出日時 2019-05-27 21:58:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 463 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-09-17 15:35:01
合計ジャッジ時間 1,521 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 12 WA * 1 RE * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:9: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
  return None if b is 0 else 1 + calc(a+9, b-1, coins) # 1Gの商品を10G払って購入

ソースコード

diff #

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

# 複数回の会計に分割できる
def calc(a,b,coins):

  if a + b is coins:
    return 0
  elif a + b < coins:
    return None if b is 0 else 1 + calc(a+9, b-1, coins) # 1Gの商品を10G払って購入
  else:
    if a >= 11:
      return 1 + calc(a-11, b+1, coins) # 1Gの商品を11G払って購入
    return 1 + calc(a-1, b, coins) if a >= 1 else 10 + calc(a, b-1, coins)
      
print(calc(A, B, C) or "Impossible")
0