zoukankan      html  css  js  c++  java
  • jQuery火箭图标返回顶部代码

    题目

    二分答案+一定的数学知识

    还好我知道穿完根之后f(x)的正负会发生改变

    (貌似还有的情况是什么穿而不过艹他们现在正好学函数)

    给定的定义域的范围内枚举每个点

    题目中明确指出两根范围是在1之内的

    不要瞎几把乱写吖

     1 #include <cstdio>
     2 #include <iostream>
     3 using namespace std;
     4 int num = 0;
     5 double a, b, c, d, l, r, mid, x1, x2;
     6 double check(double x) {
     7     return (a * x * x * x + b * x * x + c * x + d);
     8 }
     9 int main() {
    10     cin >> a >> b >> c >> d;
    11     for(double i = -100; i <= 100; i++) {
    12         l = i, r = i + 1;
    13         if(!check(l)) printf("%.2lf ", i);
    14         if(check(l) * check(r) < 0) {
    15             while(r - l > 0.001) {
    16                 mid = (l + r) / 2;
    17                 if(check(mid) * check(l) <= 0) r = mid;
    18                 else l = mid;
    19             }
    20             printf("%.2lf ", l);
    21         }
    22     }
    23 //    printf("%.2lf", mid);
    24     return 0;
    25 }

    谢谢收看,祝身体健康!

  • 相关阅读:
    nyoj 42 一笔画 欧拉通路
    布丰投针实验1
    poj 1328 贪心
    uva 10026 贪心
    zoj 1375 贪心
    uva 103 经典DAG变形
    uva 11088 暴力枚举子集/状压dp
    jsp分页功能
    static静态变量的理解
    Vector & ArrayList 的主要区别
  • 原文地址:https://www.cnblogs.com/yanxiujie/p/11700468.html
Copyright © 2011-2022 走看看