B - Nuts Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200200

問題文

NN 本の木があり、 ii 番目の木には AiA_i 個の木の実が実っています。

シマリスは、次のルールで全ての木から木の実を収穫します。

  • 実っている木の実が 1010 個以下の木からは木の実を収穫しない
  • 実っている木の実が 1010 個より多い木からは、1010 個を残して残りの全てを収穫する

シマリスが収穫する木の実の個数の合計を求めてください。

制約

  • 1N10001 \leq N \leq 1000
  • 0Ai10000 \leq A_i \leq 1000
  • 入力に含まれる値は全て整数である

入力

入力は以下の形式で標準入力から与えられる。

NN
A1A_1 \ldots ANA_N

出力

答えを出力せよ。


入力例 1Copy

Copy
3
6 17 28

出力例 1Copy

Copy
25

33 本の木からそれぞれ 0,7,180,7,18 個の木の実を収穫します。よって合計は 2525 個です。


入力例 2Copy

Copy
4
8 9 10 11

出力例 2Copy

Copy
1

Score : 200200 points

Problem Statement

There are NN trees. The ii-th tree bears AiA_i nuts.

Chipmunk will harvest nuts from the trees in the following manner:

  • From a tree with 1010 or fewer nuts, she does not take nuts.
  • From a tree with more than 1010 nuts, she takes all but 1010 nuts.

Find the total number of nuts Chipmunk will take from the trees.

Constraints

  • 1N10001 \leq N \leq 1000
  • 0Ai10000 \leq A_i \leq 1000
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN
A1A_1 \ldots ANA_N

Output

Print the answer.


Sample Input 1Copy

Copy
3
6 17 28

Sample Output 1Copy

Copy
25

From the three trees, Chipmunk will take 00, 77, and 1818 nuts, for a total of 2525 nuts.


Sample Input 2Copy

Copy
4
8 9 10 11

Sample Output 2Copy

Copy
1


2025-04-02 (Wed)
11:46:32 +00:00