Count of Numbers 2
InterviewTime limit1sMemory limit128 MB
Multiply three positive integers and count how many times each digit 0 through 9 appears in the decimal representation of the product.
- Level
Easy2 of 10
- Topics
- Math, Implementation, Array
- Solved
- No attempts yet
Problem
Given three positive integers A, B, and C, write a program that finds how many times each digit from 0 to 9 appears in the value of A × B × C.
For example, if A = 150, B = 266, and C = 427, then A × B × C = 150 × 266 × 427 = 17037300, and in the result 17037300 the digit 0 appears 3 times, the digit 1 appears 1 time, the digit 3 appears 2 times, and the digit 7 appears 2 times.
Input
A is given on the first line, B on the second line, and C on the third line. A, B, and C are all positive integers less than 1,000,000.
Output
On the first line, print how many times the digit 0 appears in the value of A × B × C. Likewise, from the second line through the tenth line, print how many times each digit from 1 to 9 appears in the value of A × B × C, one per line in order.