Here is the link to my code - https://ide.codingblocks.com/s/442913
in this code , the test case 3 and 4 of spoj are not giving correct answers ;
where if we take n = 10 and elements as
0,0,100,0,0,0,0,0,0,0
the output comes out to be 610 but desired output should be 70,
is there some error??