Different o/p by c++ 4.3.2 and c++ 4.8.1 in solving problem SUMTRIAN(easy)

http://www.codechef.com/viewsolution/2896799
o/p AC compiler used : 4.3.2
http://www.codechef.com/viewsolution/2896776
o.p WA compiler used :4.8.1

similar code.
Can somebody explain me the reason?
Thanx in advance.
:slight_smile:

You’re mixing scanf and cin, weird stuff happens when you do that.

it could be explained by the fact your m array starts uninitialized.

g++ 4.3.2 could add an initialization part for you, and g++ 4.8.1 not.

maybe.

i took your code, and just added m={0} : got AC.

1 Like

but that doesn’t explain why it got AC in one and WA in other.