题解 | #奖学金#
奖学金
https://www.nowcoder.com/practice/cee98a512ec246a2918ea8121f7612c8
while(1):
try:
n,r,avg = map(int,input().split())
s_total = n*avg
st = []
for i in range(n):
s,t = map(int,input().split())
s_total -= s
st.append([s,t])
if s_total<=0:
print(0)
else:
st.sort(key = lambda x: x[1])
cost = 0
for s,t in st:
if r-s >= s_total:
break
cost += t*(r-s)
s_total -= r-s
cost += t*s_total
print(cost)
except:
break

