ICode9

精准搜索请尝试: 精确搜索
  • AcWing 790. 数的三次方根2022-07-28 15:02:55

    实数二分模板题 实数二分与整数二分差不多,但要注意精度。 首先,我们知道,答案在 \(-10000 \sim 10000\) 之间。 如何判断在区间内能否二分呢?那就需要运用到二分的二段性了。 我们可以把这个区间分成两部分: 左区间 $ < \sqrt[3]{n}$; 右区间 $ \geq \sqrt[3]{n}$。 具体步骤: 找中间

  • Codeforces Round #790 (Div. 4) A-H2022-05-13 02:32:38

    Codeforces Round #790 (Div. 4) A-H A 题目 https://codeforces.com/contest/1676/problem/A 题解 思路 知识点:模拟。 照着模拟(细节加0防炸char,虽然这里没用)。 时间复杂度 \(O(1)\) 空间复杂度 \(O(1)\) 代码 #include <bits/stdc++.h> using namespace std; int main(){ s

  • [AcWing 790] 数的三次方根2022-04-25 00:33:28

    点击查看代码 #include<iostream> using namespace std; int main() { double x; scanf("%lf", &x); double l = -1e5, r = 1e5; while (r - l > 1e-8) { double mid = (l + r) / 2; if (x <= mid * mid * mid) r =

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有