Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Mathematics and Computer Science
The milliard Vasya's function
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 47, Accepted users: 35
Problem 10005 : No special judgement
Problem description
  Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But how can he do that if the most interesting facts such as Pythagor's theorem are already proved? Correct! He is to think out something his own, original. So he thought out the Theory of Vasya's Functions. Vasya's Functions (VF) are rather simple: the value of the Nth VF in the point S is the number of integers from 1 to N that have the sum of digits S. You seem to be great programmers, so Vasya gave you a task to find the milliard VF value (i.e. the VF with N=1000000000) because Vasya himself won't cope with the task. Can you solve the problem?

Input
  There will be multiple test cases. Each line of input contains one integer S (1 S 81). And the last line of 0 means the end of input which should not be processed.

Output
  For each test case, output the milliard VF value in the point S in a line.

Sample Input
1
81
0
Sample Output
10
1
Problem Source
  HNU Contest 

Submit   Discuss   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:326 today,10600160 total, since 2010-05-07