After Took succeeds in winning Popek's heart, he faces a new challenge. In order to be…
- User
After Took succeeds in winning Popek's heart, he faces a new challenge. In order to be able to propose to Popek, he has to solve a difficult problem that Popek's father - Mr. Toraj - has set for Tok...
Mr. Torej, the sequence a 1 , a 2 , . . . . , a k a 1 , a 2 ,...,a k An arithmetic number is considered a good sequence if the following conditions are met:
0 ≤ a 1 ≤ d 0≤a 1 ≤d 2 ≤ i ≤ k ,
∣ a i
a i
1 ∣ ≤ d 2≤i≤k, ∣a i -a i−1 ∣≤d
Mr. Toraj values d d and k Having defined k for tuq, tuq must now count the remaining number of good sequences 1 0 9 + 7 10 9 find +7 so that he can go to Popek's proposal.
input In the only input line two numbers respectively k k and d d has come. 0 ≤ d ≤ 2
000 0≤d≤2000 1 ≤ k ≤ 100 1≤k≤100
output In the only remaining output line, count the number of good sequences 1 0 9 + 7 10 9 Print +7.
Example Sample entry 1 2 2 Plain text Sample output 1 12 Plain text Sample input 2 1 10 Plain text Sample output 2 11
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.