|
|
вернуться в форумWhy WA? Help me!! There is my program : {@judge_id:15324hh 1083 pascal} var ans,l,k,n,i:longint;str:string; begin read(n);readln(str);l:=0; for i:=1 to length(str) do if str[i]='!' then l:=l+1; if l>n then writeln(n) else begin ans:=n; while (n>0) do begin n:=n-l; if n>1 then ans:=ans*n; end; end; writeln(ans); end. Please, help me. Re: Why WA? Help me!! Have you test you program????? There was a small bug ,but which can be found by simple test. There was the correct program... See Line (*******) It should there hehe Good luck next time. Bye.. var ans,l,k,n,i:longint;str:string; begin read(n);readln(str);l:=0; for i:=1 to length(str) do if str[i]='!' then l:=l+1; if l>n then writeln(n) else begin ans:=n; while (n>0) do begin n:=n-l; if n>1 then ans:=ans*n; end; ****** writeln(ans); end; end. |
|
|