结果只有RE
  • 板块工单反馈版
  • 楼主user404
  • 当前回复1
  • 已保存回复1
  • 发布时间2020/12/16 11:58
  • 上次更新2023/11/5 06:04:31
查看原帖
结果只有RE
432672
user404楼主2020/12/16 11:58

p1023 不知道为何结果只有RE

用的 python Ide spyder

本来自己写的时通过多个input输入不和规则改为一个,结果提交评测还是不行,而在ide两种我都通过了,之前用python写的业没有遇到此问题

附上代码:

price_list = [] amount_list =[] #regulatedSum_list =[]

inputlist=input().split('\n')

want_price_place=0

want_price = int (inputlist[0])

zs=1

while inputlist[zs]!="-1 -1" :

price, amount= inputlist[zs].split(" ")
price =int(price)
amount= int(amount)

if len (price_list)!=0:
    price_list.append(price-price_list[0])
   
else:
    price_list.append(price)

zs+=1

amount_list.append(amount)

Reduce_amdout = int(inputlist[zs+1]) amount_now = amount_list[len (amount_list)-1]

while amount_now - Reduce_amdout >0: amount_now -= Reduce_amdout amount_list.append(amount_now) price_list.append(price_list[len(price_list)-1]+1)

for i in range(0,len (price_list)): #print( price_list[i],(want_price- price_list[0])) if price_list[i]== (want_price- price_list[0]):

    want_price_place = i

price_list[0]=0

this_round_price_inc= [] this_round_price_dec= [] now_p = 1

for i in range(0,len (price_list)-1) : this_round_price_inc.append((price_list[i]+now_p)*amount_list[i]) this_round_price_dec.append((price_list[i]-now_p)*amount_list[i])

# think what if no max

while max(this_round_price_inc)!= this_round_price_inc[want_price_place] and max(this_round_price_dec)!= this_round_price_dec[want_price_place]and max(this_round_price_inc)<10000: this_round_price_inc,this_round_price_dec=[],[] now_p+=1 for i in range(0,len(price_list)-1) : this_round_price_inc.append((price_list[i]+now_p)*amount_list[i]) this_round_price_dec.append((price_list[i]-now_p)*amount_list[i])

#print(max(this_round_price_inc) ,this_round_price_inc[want_price_place], " ",max(this_round_price_dec), this_round_price_dec[want_price_place])

print(now_p)

2020/12/16 11:58
加载中...