문제
번역본 보기A standard die produces an integer from 1 through 6. Count all nonempty ordered sequences of outcomes whose sum is target. Different orders count separately. Return the count modulo 1,000,000,007.
Implement dice_combinations(target).
Input
target: The required sum of all rolls.
Output
Return the number of sequences modulo 1,000,000,007.
제약 조건
1 ≤ target ≤ 1,000,000. Taking a count modulo 1,000,000,007 means returning its remainder after division by that number.
예시
입력:
target = 2
예상 출력:
expected = 2
입력:
long long target = 2;
예상 출력:
long long expected = 2;
입력:
long target = 2;
예상 출력:
long expected = 2;
설명
The two sequences are [2] and [1, 1].
입력:
target = 4
예상 출력:
expected = 8
입력:
long long target = 4;
예상 출력:
long long expected = 8;
입력:
long target = 4;
예상 출력:
long expected = 8;
설명
The sequences are [4], [1,3], [3,1], [2,2], [1,1,2], [1,2,1], [2,1,1], and [1,1,1,1].
참고 자료
이 문제는 CodeUtility에 맞게 수정되었습니다. 위의 설명과 제한 조건을 따르세요.