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.
如何编写具有 O(c^k) - 指数时间复杂度的 for 循环?我想编写一个具有 O(3^n) 的 for 循环
如果你想要一个循环来做到这一点
for(long i = 0; i < Math.power(c, k); i++)
或者
for(long i = 0; i < Math.power(3, n); i++)