This is very critical, we should use long long. Try the following test case:
20 39
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 ...
Search found 2 matches
- Fri Nov 25, 2011 2:55 pm
- Forum: Volume 105 (10500-10599)
- Topic: 10564 - Paths through the Hourglass
- Replies: 30
- Views: 18416
- Mon Nov 21, 2011 1:03 pm
- Forum: Volume 106 (10600-10699)
- Topic: 10626 - Buying Coke
- Replies: 23
- Views: 18029
Re: 10626 - Buying Coke
zslwyuan,
Instead of calculating "n1", you need to consider passing "n1" in the "dp" function and apply necessary deduction (or addition) in the recursive "dp" call.
Thanks.
Instead of calculating "n1", you need to consider passing "n1" in the "dp" function and apply necessary deduction (or addition) in the recursive "dp" call.
Thanks.