|
|
back to boardRe: 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 |
|
|