/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 233 点
問題文
高橋君はオフィスビルの空調管理を担当しています。今日、ビル内の N 個の部屋の温度をチェックすることになりました。
快適なオフィス環境のため、各部屋の温度は 37 度以下に保つ必要があります。温度が 37 度より高い部屋は、エアコンを使って冷却しなければなりません。温度が既に 37 度以下の部屋は冷却の必要がありません。
i 番目の部屋 (1 \leq i \leq N) の現在の温度は T_i 度です。高橋君は 1 回の操作で、N 個の部屋から 1 つを選び、その部屋の温度をちょうど 0.1 度下げることができます。同じ部屋を複数回選ぶこともできます。
すべての部屋の温度を 37 度以下にするために必要な操作の合計回数の最小値を求めてください。
制約
- 1 \leq N \leq 2 \times 10^5
- 0.0 \leq T_i \leq 50.0
- T_i は小数第 1 位までの実数である(すなわち、10 \times T_i は整数である)
- 入力において、各 T_i は必ず小数第 1 位まで表記される(例:整数値であっても
37.0のように与えられる)
入力
N T_1 T_2 \cdots T_N
- 1 行目には、部屋の数を表す整数 N が与えられる。
- 2 行目には、各部屋の温度(度)を表す T_1, T_2, \ldots, T_N が、スペース区切りで与えられる。
- 各 T_i は小数第 1 位までの表記で与えられる。
出力
すべての部屋の温度を 37 度以下にするために必要な操作の合計回数の最小値を、整数で 1 行に出力せよ。
入力例 1
3 36.5 37.0 38.2
出力例 1
12
入力例 2
5 37.3 40.0 36.0 38.5 37.0
出力例 2
48
入力例 3
10 35.0 37.5 42.0 37.0 39.8 36.9 50.0 38.0 37.1 41.5
出力例 3
269
Score : 233 pts
Problem Statement
Takahashi is in charge of air conditioning management for an office building. Today, he needs to check the temperatures of N rooms in the building.
For a comfortable office environment, the temperature of each room must be kept at 37 degrees or below. Rooms with temperatures higher than 37 degrees must be cooled using air conditioners. Rooms whose temperatures are already 37 degrees or below do not need cooling.
The current temperature of the i-th room (1 \leq i \leq N) is T_i degrees. In one operation, Takahashi can choose one of the N rooms and lower its temperature by exactly 0.1 degrees. The same room can be chosen multiple times.
Find the minimum total number of operations required to make the temperature of every room 37 degrees or below.
Constraints
- 1 \leq N \leq 2 \times 10^5
- 0.0 \leq T_i \leq 50.0
- T_i is a real number with exactly one decimal place (i.e., 10 \times T_i is an integer)
- In the input, each T_i is always written with exactly one decimal place (e.g., even integer values are given as
37.0)
Input
N T_1 T_2 \cdots T_N
- The first line contains an integer N, representing the number of rooms.
- The second line contains T_1, T_2, \ldots, T_N, representing the temperature (in degrees) of each room, separated by spaces.
- Each T_i is given with exactly one decimal place.
Output
Print the minimum total number of operations required to make the temperature of every room 37 degrees or below, as an integer on a single line.
Sample Input 1
3 36.5 37.0 38.2
Sample Output 1
12
Sample Input 2
5 37.3 40.0 36.0 38.5 37.0
Sample Output 2
48
Sample Input 3
10 35.0 37.5 42.0 37.0 39.8 36.9 50.0 38.0 37.1 41.5
Sample Output 3
269