Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Online IDE's input vs local input problem

$
0
0

I participated in the October Cook Off and came up with the correct solution to the third problem, My solution: https://www.codechef.com/viewsolution/15935866 . It gives wrong answer on online judges but run perfectly fine on my machine.
If I make a small change. Replacing scanf by cin then the judge identifies the solution as correct as can be seen in this submission: https://www.codechef.com/viewsolution/15950702
Changes:
In original :-
scanf("%d", &T);
cin >> str;
In modified:-
cin >> T;
cin >> str;
What things can I do to avoid this in the future ? (Should I not mix and match scanf/printf with cin/cout ?) Aren't online judges at fault here ? ( ideone and Codechef both are giving incorrect results here)


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>