OJUMPS - wrong answer

here is the link of my code- http://www.codechef.com/viewsolution/5215162
can anyone tell me whats wrong with my code? its getting wrong answer but in my compiler I checked all possible cases.

@akshaynit

i saw many threads on discussion forum discussing about the disadvantages of gets(); as it does not prevents overflow

So i just replaced gets(); with scanf(); and thats it…

Solution Accepted!!

You may check the submission on this Link.

3 Likes

By the way Nice Logic :slight_smile:

thanks man,I got AC.But what was the problem with gets(); even if I was entering less than or equal to 18 elements?

Bro even i dont know the technical reason but similar problem was faced by me during an ongoing contest and when i searched about the reason then i found many pages on stackoverflow.com and discussion forum where users recommend fgets() over gets() or just use scanf().

But you may use getchar() to receive the input. I usually implement getchar_unlocked() to take input.

You may post this question on discussion forum or stackoverflow.com.

Try one thing. Make a program to generate a long long number of size 10^18 save it in a file and using gets try executing your program on ideone.com using that number and see what is the output…

You may find some weird output . . .

Someone please help me out it’s showing wrong answer even though it’s working fine on my compiler and giving the correct output for corner cases as well. Here is the link to my solution https://www.codechef.com/viewsolution/10871125

i am getting NZEC error.please anyone help me code here

#include
using namespace std;
int main()
{
long long a;
cin>>a;
if(a%6==0||a%6==3||a%6==1)
cout<<"yes"<< endl;
else
cout<<"no"<< endl;
return 0;
}