Hi codeforces community, I'm new to codeforces and also a beginner in competitive coding.In the previous contest, i tried to solved this question . "http://codeforces.net/contest/879/problem/B ". the code run perfectly on my compiler ,but it failed to run in some test cases codeforces compiler .i tried in few other online compiler, they gave the same response as my compiler gave. My solution "http://codeforces.net/contest/879/submission/31767149". So i request if someone could help from the community.
Thank you in advance.
It's really quite obviously because K needs to be long long. On an unrelated note, I'd strongly recommend properly indenting your code; the way it's written now is basically unreadable.
First of all take long long int since maximum k is 1e12
Then for the case d <= c you need to do count = 1 not 0
AC Code
The following is a bit more readable C++11 solution for the problem.
31773713
Best wishes