Cod sursa(job #974602)
| Utilizator | Data | 17 iulie 2013 17:58:32 | |
|---|---|---|---|
| Problema | Pascal | Scor | 40 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
var s,st:int64;
d:byte;
r,i,v:longint;
a:array[1..5000000]of byte;
begin
assign(input,'pascal.in'); reset(input);
readln(r,d);
v:=d; i:=1;
while v<=r do begin a[v]:=a[v div d]+1; inc(i); v:=v+d; end;
for i:=1 to r-1 do
begin
s:=s+a[r-i+1]-a[i];
if s>0 then st:=st+1;
end;
assign(output,'pascal.out'); rewrite(output);
writeln(st);
close(output);
end.