完全平方数是一系列奇数之和

it2022-05-09  24

1 = 14 = 1 + 39 = 1 + 3 + 516 = 1 + 3 + 5 + 725 = 1 + 3 + 5 + 7 + 936 = 1 + 3 + 5 + 7 + 9 + 11....1+3+...+(2n-1) = (2n-1 + 1)n/2 = n*n

时间复杂度为O(sqrt(n))。

转载于:https://www.cnblogs.com/Blue-Keroro/p/7989041.html


最新回复(0)