前言

炒尸辣!炒尸辣!

丸辣!long long 也炸辣!


时间复杂度

O(1)\mathcal{O}(1) 的算法能解决的数据范围不限。

O(log⁡n)\mathcal{O}(\log n) 的算法能解决的数据范围约等于不限。

O(n)\mathcal{O}(\sqrt{n}) 的算法能解决的数据范围在 n≤1016n \le 10^{16}。

O(n)\mathcal{O}(n) 的算法能解决的数据范围在 n≤108n \le 10^8。

O(nlog⁡n)\mathcal{O}(n \log n) 的算法能解决的数据范围在 n≤106n \le 10^6。

O(n2)\mathcal{O}(n^2) 的算法能解决的数据范围在 n≤5000n \le 5000。

O(n3)\mathcal{O}(n^3) 的算法能解决的数据范围在 n≤300n \le 300。

O(n4)\mathcal{O}(n^4) 的算法能解决的数据范围在 n≤100n \le 100。

O(2n)\mathcal{O}(2^n) 的算法能解决的数据范围在 n≤25n \le 25。

O(n!)\mathcal{O}(n!) 的算法能解决的数据范围在 n≤11n \le 11。

以上范围仅供参考,实际中还要考虑每种算法的常数。

变量

类型 含义 数据范围
int 整数 −2147483648-2147483648~2147483647(2×109)2147483647(2×10^9)
long long 长整数 −9223372036854775808-9223372036854775808~9223372036854775807(9×1018)9223372036854775807(9×10^{18})
double 小数 −10308-10^{308}~1030810^{308}