Got wrong answer with stdio.h header file but the same code is accepted when using iostream or bits/stdc++.h

Revision en1, by praveenojha33, 2019-02-11 00:18:24

Currently I was practicing on a virtual contest and for this problem https://codeforces.com/contest/1003/problem/C I got wrong answer for test case 1 ( though everything was working correctly offline and on other online compilers for same test case) after the contest when I looked at the test case and changed the header file to iostream, the same solution got Accepted. Can anyone please help me to figure out why such error occurred.

1)Link of submission getting WA verdict(with stdio.h header file):https://codeforces.com/contest/1003/submission/49744850

2)Link of same code on ideone getting correct output for same test case (with stdio.h header file): https://ideone.com/QPqinX

3)Link of same submission getting accepted using iostream header file: https://codeforces.com/contest/1003/submission/49745087

My Offline gcc version is 7.3.0(C++17) . Everything works fine on ideone also with gcc 6.3.0 (C++14)

Tags c++, stdio, iostream, header file

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English praveenojha33 2019-02-11 00:41:47 2 Tiny change: 'racticing on a virtua' -> 'racticing in a virtua'
en1 English praveenojha33 2019-02-11 00:18:24 1059 Initial revision (published)