Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我基本上有一个 24 位数字,我需要得到该数字与 1 和 0 的每个组合我知道有超过 16,700,000 种可能的组合。我需要为我正在开发的极小极大算法游戏获取每一个可能的组合。如果你有一个算法,那就太棒了。谢谢。
您可以将 unsigned int 从 0 迭代到 2^24-1:
for (uint32_t i = 0; i < 1U<<24; ++i) { // do something with LS 24 bits of i ... }
这将为您提供i.
i