← 返回 google 的题目列表Count 4-Digit Codes with Digit Sum Equal to S
类型:online_judge
google
Sum of Four-Digit Codes
Consider all codes made of four digits (0-9). Count how many of them have a sum of digits equal to an integer S. How many such codes exist?
Examples
S = 35, the resulting array is: [9998, 9989, 9899, 8999]. Therefore, the answer is 4.
S = 27, the function should return 935.
Assume:
S is an integer within the range [0, 36].
Example
Input
35