問題一覧 > 通常問題

No.1231 Make a Multiple of Ten

レベル : / AI推定難易度 : 750 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 296
作問者 : MATSUMAT / テスター : asdf1
お気に入りにしたユーザー ProblemId : 2651 / 自分の提出
問題文最終更新日: 2020-09-09 21:14:57
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 266 (順位表) の他の問題:

Problem Statement

There are $N$ cards with positive integers written on them, and the $i$-th card has $A_{i}$ written on it.
When choosing cards so that the sum of the integers written on them is a multiple of $10$, find the maximum number of cards that can be chosen.
Note that if not even $1$ card is chosen, the sum is $0$, and this is also considered a multiple of $10$.

Input

$N$
$A_{1}\ A_{2}\ ...\ A_{N}$

・$1\ ≤\ N\ ≤\ 2 \times 10^{5}$
・$1\ ≤\ A_{i}\ ≤\ 10^{9}\ \ (1\ ≤\ i\ ≤\ N)$
・$N, A_{i}$ are integers.

Output

Output on one line the maximum number of cards used when choosing cards so that the sum is a multiple of $10$. Print a newline at the end.

Sample

Sample 1
Input
5
1 3 5 7 9
Output
4

Taking the cards $1, 3, 7, 9$ gives a sum of $20$, which is a multiple of $10$.

Sample 2
Input
9
1 1 1 1 1 1 1 1 1
Output
0

The only way to make the sum a multiple of $10$ is to not take any cards.

Sample 3
Input
10
1 1 1 1 1 1 1 3 7 9
Output
8

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。