Created
September 23, 2015 08:57
-
-
Save koki-h/d4d0c723017f2c3ec3a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #AtCoder Beginner Contest 029 D問題の回答 | |
| #http://abc029.contest.atcoder.jp/tasks/abc029_d | |
| #問題文 | |
| #高橋君は 1 以上 N 以下のすべての整数を十進表記で一回ずつ紙に書きました。 | |
| #この作業で、高橋君は 1 という数字を何個書いたでしょうか。 | |
| #時間がかかるのはわかっているので最初から部分点狙い。 | |
| max = gets | |
| count = 0 | |
| 1.upto(max.to_i) do |i| | |
| count += i.to_s.count("1") | |
| end | |
| puts count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment