Official
B - 試験対策 / Exam Preparation Editorial
by
B - 試験対策 / Exam Preparation Editorial
by
sounansya
科目 \(i\) について、\(A_i < T\) なら追加で \(T-A_i\) 点上げる必要があり、 \(A_i \geq T\) なら追加で点数を上げる必要がありません。したがって、\(A_i < T\) を満たす \(i\) に対する \((T-A_i) \times C_i\) の総和を計算すれば良いです。
n, t = map(int, input().split())
ans = 0
for i in range(n):
a, c = map(int, input().split())
if a < t:
ans += (t - a) * c
print(ans)
posted:
last update:
