|
|
вернуться в форумWhy WA6 This is my program: program Ural1057; var a,l,r,n,k,ans:longint; p:array[0..200]of longint; d:array[0..200]of qword; num:qword; procedure dfs(o:longint); var i:longint; begin for i:=p[o-1]+1 to 30 do begin p[o]:=i; num:=num+d[p[o]]; if num>r then begin num:=num-d[p[o]]; exit; end; if o=n then begin if l<=num then inc(ans); end else dfs(o+1); num:=num-d[p[o]]; end; end; begin readln(l,r,n,k); fillchar(p,sizeof(p),0); d[0]:=1; a:=1; while (d[a-1]<r)and(a<40) do begin d[a]:=d[a-1]*k; inc(a); end; ans:=0; num:=0; p[0]:=-1; dfs(1); writeln(ans); end. I don't know why Wa6, who can help me? |
|
|