下面两层循环的时间复杂度是 O(n2)。 for (int i = 0; i < n; i++) { for (int j = 1; j < n; j *= 2) { cout << i + j; } }