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 1057. Amount of Degrees

HELP!!!
Posted by Saturn 31 Jul 2004 10:01
My program gives right answer all tests in the forum but T've got WA#2.Please give me some test
Thanks
Re: HELP!!!
Posted by Saturn 31 Jul 2004 10:26
Oh,I got AC now!
Re: HELP!!!
Posted by Kopeliovitch Sergey (1) 31 Jul 2004 14:16
I have WA #2 too.
Can you give me some tests?
Re: HELP!!!
Posted by Saturn 31 Jul 2004 23:32
Some tests:
1 100 2 4 ->6
1 300 4 8 ->0
1 400 4 2 ->111
You can use this full search program to check:
//////////////
var
        x,y,k,b,p,q:longint;

function kt(s:longint):longint;
var
    a:array[1..40]of longint;
    sd,i,j:longint;
begin
        sd:=0;
        repeat
                inc(sd);
                a[sd]:=s mod b;
                s:=s div b;
        until s=0;
        j:=0;
        for i:=1 to sd do
        if a[i]=1 then inc(j)
        else if a[i]>1 then begin kt:=0; exit; end;
        kt:=j;
end;

begin
        read(x,y,k,b);

        p:=0;
        for q:=x to y do
        if kt(q)=k then inc(p);
        writeln(p);
end.
/////////
Good luck!
Re: HELP!!!
Posted by nguyenductam 5 Apr 2010 10:50
Thank you Saturn.