← 返回 google 的题目列表Count Four-Digit Combinations with Given Digit Sum
类型:online_judge
google
Given an integer 'sum', find all combinations of four digits (0-9) that sum to 'sum'. Calculate the total number of such combinations. The input is an integer 'sum'. The output is the number of all valid combinations.
Example:
Input: 12
Output: 15
Explanation: There are 15 combinations such as 0039, 0138, ..., 4440 that sum to 12.
Example
Input
0