Lately, Ive been trying many questions.For some fairly simple questions, I end up with the correct algorithm and code. It gives the correct answer for many test cases.(even the boundaries) but when i submit i get wrong answer. Ive seen many people (using same alto) get wrong answers and then finally correct it. What is that you people do. Is there anything special other than using % when dealing with modulus 10^9+7, and which data type do you use to handle very very large integers in c/ c++. Im using long long (%lld). Please give me suggestions as how you correct the wrong answer. Its been really frustrating?

For example DBOY :http://www.codechef.com/viewsolution/1593046

Hello,

About DBOY, I recommend you read editorials and try to implement your solution by carefully following the idea described…

As far as large integers are concerned, you can represent extremely large numbers using arrays…

There are some tricks and conventions related to large integer representation that you can be more informed about by reading some online tutorials…

I can also recommend you to attempt the practice problem:

Small Factorials

There you can find a link to a tutorial where a good starting explanation about large integers representation is given… So, if you can read it and afterwards correctly solve that problem, it means you have understood the underlying idea behind large integers representation.

Good luck,

Bruno

I also came across similar problems, some of which can be corrected by using these methods :

1. Check for corner cases, specially for bottom cases.
2. If you are incrementing a variable to count something, check that you have initialized it to 0.
3. If there are multiple test cases, and you are using a counter variable, check that you initialize the counter variable to 0 everytime you have a new test case.

Hope this would help to some extent. It may be frustrating in the beginning but do not give up.