Is codechef a fucking retard?
Or am I?
I have this problem to solve: https://www.codechef.com/problems/SUMTRIAN
And this was my proposed solution: http://pastebin.com/TuXJ0FUw
It follows the logic of pic related.
Works fine with the test values and some of my own.
Codechef says it's a wrong answer.
Is it right or not?!
Have a more readable version of the code.
How many different paths are there in a triangle with 4 rows brainlet?
>>8603648
0 rows -> 0 paths
1 row -> 1 path
2 rows -> 2 paths
3 rows -> 4 paths
4 rows -> 7 paths
5 rows -> 12 paths
For 'n' rows you have 1 + a + b, a being the amount of paths for n - 1 rows and b for n - 2.
Want the general solution senpai?
>>8603374
you're wrong. why don't you look at the accepted solutions and compare?
>>8604472
The accepted solutions are fine and use different but equally valid methods which should lead to the same outcome mine reaches with any test case.
I need an explanation. Why am I wrong?
It doesn't look like the solution is wrong.
>>8604456
Hint:At every fork, you can choose between one path or the other. You have an even amount of choices. An even amount of choices would not lead to an odd amount of paths
In fact, 7 is prime, so there's literally no way to arrive at 7 paths.
>>8604478
as an ICPC world finalist, let me tell you this: the process of fixing your answer and understanding why it's wrong is very important, as much as writing it itself
>>8604478
I just ran your code with their sample input and it does not match their output.
>>8604487
This
Not trying to make you look like an idiot OP, just trying to make you see where you went wrong.
There was another possible path and I didn't consider it.
Thanks everyone for your help.