Mic*_*cah 3 language-agnostic algorithm round-robin
基本上我有玩家名单,我想把它们配对,这样每个玩家都会玩一次.找到这些数据的最快方法是什么?
假设玩家没有两次出现在列表中,双for循环非常快:
for (int i=0, i <= playerList.Count - 2, i++)
for (int j=i+1, j <= playerList.Count - 1, j++)
//add a new pairing of player i and j
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2943 次 |
| 最近记录: |