|
|
вернуться в форумI got AC but if u know algorithm O(n) please send it to me(e-mail inside message) vladimir_mnog@mail.ru tnxx Re: I got AC but if u know algorithm O(n) please send it to me(e-mail inside message) VAR N,M:longint; FUNCTION Josefus(N,M:longint):longint; var L,c:longint; begin L:=0; for c:=1 to N do L:=(L+M-1) mod c + 1; Josefus:=L; end; BEGIN readln(N,M); writeln(Josefus(N,M)); END. |
|
|