総当たり戦の日程作成
Posted feedbacks - Erlang
無かったので、書いてみました。 Scala版の移植です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | -module(match_sche).
-export([make/1]).
make(L) -> make_loop([], L).
make_loop(Acc, [H|L]) ->
if
length(Acc) =:= length(L) -> Acc;
true ->
{A,B} = lists:split(round(length([H|L])/2), [H|L]),
Newacc = [lists:zip(A, lists:reverse(B))|Acc],
[LH|LL] = L,
Newl = [H|lists:append(LL,[LH])],
make_loop(Newacc, Newl)
end.
|


ryugate
#5661()
Rating2/2=1.00
see: カークマンの組分け
[ reply ]