結果

問題 No.825 賢いお買い物
ユーザー YCescaYCesca
提出日時 2019-05-04 04:47:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 944 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 7,940 KB
最終ジャッジ日時 2023-09-02 00:24:48
合計ジャッジ時間 1,850 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,912 KB
testcase_01 AC 16 ms
7,808 KB
testcase_02 AC 16 ms
7,812 KB
testcase_03 RE -
testcase_04 AC 16 ms
7,844 KB
testcase_05 WA -
testcase_06 RE -
testcase_07 AC 15 ms
7,872 KB
testcase_08 AC 16 ms
7,792 KB
testcase_09 AC 16 ms
7,792 KB
testcase_10 AC 16 ms
7,848 KB
testcase_11 AC 16 ms
7,852 KB
testcase_12 AC 16 ms
7,908 KB
testcase_13 RE -
testcase_14 AC 16 ms
7,800 KB
testcase_15 AC 16 ms
7,792 KB
testcase_16 AC 15 ms
7,812 KB
testcase_17 AC 16 ms
7,784 KB
testcase_18 AC 16 ms
7,788 KB
testcase_19 AC 16 ms
7,796 KB
testcase_20 AC 16 ms
7,840 KB
testcase_21 AC 16 ms
7,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def get_price(i: int) ->int:
  price = (10 * b + a) - (10 * (c-i) + i) 
  return price

# index= = 購入後のaの値 となる 買った商品の購入額のリスト
plist=[0]*(c+1)

if a+b < c:
  pind=0
  for i in range(c+1):
    plist[i]=get_price(i)
    if plist[i] <= 0:
      pind=i
  if plist[pind] <= 0 & pind <=c:
    pind+=1
#途中で正に変わる場合の仕掛け
#チェックが必要
#変化後のa=pind 変化後のb=c-pind
  price=plist[pind]

  checka=a
  checkb=b
  defb=b-(c-pind)
  checkb=c-pind
  temp=10 * defb - plist[pind]
  checka+=temp%10
  checkb+=temp//b

  if (checka == a & checkb == b):
    print(price)
  else:
    print("Impossible")

else:
  pind=0
  for i in range(c+1):
    plist[i]=get_price(i)
    if plist[i] <= 0:
      pind=i
  if plist[pind] <= 0 & pind <=c:
    pind+=1  
  price=plist[pind]
    
  if price <= 0 :
    print("Impossible")
  else:
    print(price)
0