A new problem
Given an big integer N, how to judge that whether there exists an integer m where N=m*m with O(1) time complexity.For example, for the number 9, there exists an integer 3 that 3*3=9.
For the number 18, we cannot find the proper number.
PS: MUST BE O(1) time complexity , which means your method can be done in constant step no matter how big the number Nis.
MUST TAKE IT INTO CONSIDERATION that N is a very very large integer. O(1)不太可能吧,依据完全平方数的性质可以判断一些数,但是不能判断所有数 不知道这样算不算:
先算$m=\sqrt{N}$
然后判断$m*m$是否等于$N$,但是对于大数就不行了
页:
[1]