【点歌】hello# Music - 天籁之音
w*g
1 楼
Q:Given a positive integer, return the integer part of its square root.
Requirements: cannot use any math functions; can only use integer
variables, no double variables even for intermediate variables; as
efficient as possible.
我想的是:从i=1 到 n/2 挨个试,如果i*i >n 就停止。
这道题有什么trick或者要注意的吗? 多谢。
Requirements: cannot use any math functions; can only use integer
variables, no double variables even for intermediate variables; as
efficient as possible.
我想的是:从i=1 到 n/2 挨个试,如果i*i >n 就停止。
这道题有什么trick或者要注意的吗? 多谢。