Strange WA

Hello, I’ve got very strange WA submitting this problem. After hours spent on searching of error, I replaced
gets(a) with scanf("%s", a) and got AC. a - char[100000]. I think that this error is very strange, isn’t it?
Now I added to my first program this string: assert(n != 15); and got WA too. It means that my program makes error at test №1. May be administrators could add more information to errors? I mean if my program crashes on test samples it would be better to know that I don’t pass samples. Or, may be, this is very strange issue of gets or bug in g++/testing system?

1 Like

Yes! I was trying to correct a perfect code for 3 days. The problem was this. I was using gets .Changed to scanf and BAM ! AC!. This is not right though. Shouldn’t give WA

Oh, common if you add assert to your C++ program and the condition is false, you will get SIGABRT and not WA.

There is a difference in behaviour of scanf and gets, search the forum to get more details as suggested in guidelines:

Read all the previously posted comments for a problem before posting your comment to avoid asking the same query twice.

1 Like