公式

A - サービス券 / Service Tickets 解説 by harurun4635 印刷ページ


上限がなければ \(\displaystyle \big \lfloor \frac{a_i}{100} \big \rfloor\) 枚配られるはずです。

ということは、実際には \(\displaystyle \min(M, \big \lfloor \frac{a_i}{100} \big \rfloor)\) 配りますから、これの総和を求めればよいです。


実装例

n, m = map(int, input().split())
a = list(map(int, input().split()))
print(sum(min(m, x // 100) for x in a))

投稿日時:
最終更新: