diff options
Diffstat (limited to 'c/0069/main.c')
| -rw-r--r-- | c/0069/main.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/c/0069/main.c b/c/0069/main.c deleted file mode 100644 index 86aab4a..0000000 --- a/c/0069/main.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <stdio.h> -#include <stdint.h> - -int mySqrt(int x) { - int64_t t = x; - int64_t ln = 0, rn = x; - while (ln <= rn) { - int64_t mid = ln + (rn - ln) / 2; - if (mid * mid < x) { - if ((mid + 1) * (mid + 1) > x) { - return mid; - } - ln = mid + 1; - } else if (mid * mid > x) { - rn = mid - 1; - } else { - return mid; - } - } - return -1; -} - -int main() { - printf("%d\n", mySqrt(9)); - return 0; -} |
