問題一覧 > 通常問題

No.656 Golf

レベル : / AI推定難易度 : 101 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 589
作問者 : nmnmnmnmnmnmnm / テスター : Nafmo2
お気に入りにしたユーザー ProblemId : 1656 / 自分の提出
問題文最終更新日: 2026-06-26 02:01:21
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 185 (順位表) の他の問題:

Problem Statement

A-kun's job is to calculate golf scorecards.
In golf, the score increases by 1 each time the ball is hit.
For example, if 4 strokes were taken on a hole, 4 is written on the scorecard and the score is 4.
As an exception, if 10 or more strokes were taken, 0 is written on the scorecard and the score is 10.
A-kun is given a scorecard for 9 holes, so calculate the total score.

Note that, by the nature of the sport of golf, it is impossible to finish a hole in 0 strokes!

Input

$S$

The scores for the 9 holes are given as a string $S$.
The i-th digit is the entry on the scorecard for the i-th hole.
The characters used are '0' to '9', and the length of the string is always 9.

Output

Output the total score, followed by a newline.

Sample

Sample 1
Input
444444444
Output
36

All 9 holes were played in 4 strokes each. Therefore, the total score is 36.

Sample 2
Input
111111110
Output
18

Holes 1 through 8 were all played in 1 stroke each, but 10 or more strokes were taken on the 9th hole.
Note that when 10 or more strokes are taken, the entry is 0 and the score is counted as 10.
The total score is 18.

Sample 3
Input
404328039
Output
53

Sample 4
Input
000000000
Output
90

This is the maximum possible score.

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