diff options
| author | Mistivia <i@mistivia.com> | 2025-09-06 23:17:22 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-09-06 23:17:41 +0800 |
| commit | ad95cba8220e2a7c86362caeb76e1a4333e9c2b8 (patch) | |
| tree | 30b31d94e2ceb46d4e946bfa1eb88b956508f760 /c/0069/main.c | |
| parent | 5dd8dcdc2ccfa89d25a3cb342a2f89c644236971 (diff) | |
refactor
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; -} |
