DWITE '11 R1 #4 - C001 Numbers

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
DWITE, October 2011, Problem 4

According to recent surveys run by various Computer Science Clubs at Canadian high schools, 0 is a cool digit. That's why we are going to define the "coolness" of a number to be the number of 0s it has (e.g. 100 has a coolness of 2, whereas 1 has no coolness). This makes counting a very cool activity, which begs the question: exactly how cool is it to be able to count up to N? We are interested in finding the total coolness of all numbers from 0 up to a given number.

There will be five lines of input, each containing a single number 0 \le N \le 10\,000\,000.

You should output five lines, each line the sum of the coolness of all the numbers from 0 to N inclusive.

Sample Input


Sample Output


Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Problem Resource: DWITE


There are no comments at the moment.