Google Code Jam 2004
■ このスレッドは過去ログ倉庫に格納されています
0022デフォルトの名無しさん
NGNGfollowed, the following algorithm is applied a number of times equal to
the weight on the edge, immediately after it is followed (note that the
cur here is the same cur as above, and that we never reset its value):
for i = 0 to nodes - 1
for j = 0 to nodes - 1
if(i does not equal j)
cur = ((cur * A) + B) % M
weight(i,j) = weight(i,j) + (cur % 21) - 10
if(weight(i,j) < 1)
weight(i,j) = 1
end if
end if
end for
end for
■ このスレッドは過去ログ倉庫に格納されています