ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1720. Summit Online Judge

WA 19 HELP!
Posted by NickSergeev[MSU MindCraft] 10 Oct 2009 18:02
Re: WA 19 HELP!
Posted by svr 11 Oct 2009 21:12
Use these functions for debugging
int f(int x,int y,int z)
{
    int i;
if (z==0) return 1;
for (i=x;i<=y;i++)
{
if (i>z) break;
if (f(x,y,z-i)==1) return 1;
}
return 0;
}
int ff(int x,int y,int l,int r)
{
int z=0;
for (int k=l;k<=r;k++) z+=f(x,y,k);
return z;
}
also:
to verivy k*x>a for big numbers is better to use:
k>=floor(a/x) if a%x!=0
k>a/x if a%x==0
because k*x can generate overflow

I got Ac after using all attention to boundary values 10^18.

Edited by author 11.10.2009 21:19