D - Can you solve this equation?

Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;
Now please try your lucky.

InputThe first line of the input contains an integer T(1<=T<=100) which means the number of test cases. Then T lines follow, each line has a real number Y (fabs(Y) <= 1e10);OutputFor each test case, you should just output one real number(accurate up to 4 decimal places),which is the solution of the equation,or “No solution!”,if there is no solution for the equation between 0 and 100.Sample Input

2
100
-4

Sample Output

1.6152
No solution!


 #include<iostream>
#include<cmath>
using namespace std; double f(double x){
return (*pow(x,) + *pow(x,) + *pow(x,) + *x + );
} int main()
{
int t;
double m,n;
scanf("%d",&t);
while(t--){
scanf("%lf",&m);
if(f()>m||f()<m){
printf("No solution!\n");
continue;
}
double left = , right = , mid;
while(fabs(f(mid)-m) > 1e-){
mid=(left + right)/;
if((f(mid) > m)) right = mid;
else if(f(mid)<m) left=mid;
}
printf("%.4lf\n",mid);
}
return ;
}

二分-D - Can you solve this equation?的更多相关文章

  1. ACM:HDU 2199 Can you solve this equation? 解题报告 -二分、三分

    Can you solve this equation? Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Su ...

  2. HDU 2199 Can you solve this equation? (二分 水题)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  3. HDU 2199 Can you solve this equation(二分答案)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  4. HDU - 2199 Can you solve this equation? 二分 简单题

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  5. hdu2199Can you solve this equation?(解方程+二分)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  6. hdu 2199 Can you solve this equation?(高精度二分)

    http://acm.hdu.edu.cn/howproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/1000 MS ...

  7. hdoj 2199 Can you solve this equation?【浮点型数据二分】

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  8. Can you solve this equation?(二分)

    Can you solve this equation? Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Ja ...

  9. HDU 2199 Can you solve this equation?(二分精度)

    HDU 2199 Can you solve this equation?     Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == ...

随机推荐

  1. Anaconda使用教程全攻略

    Anaconda使用教程全攻略 本文转自 https://zhuanlan.zhihu.com/p/32925500           〇.序 Python是一种面向对象的解释型计算机程序设计语言, ...

  2. clr via c# 泛型

    1,类型对象,对于应用程序的各种类型创建的对象叫做类型对象:Type object:对于泛型类型参数的类型,CLR同样也会创建内部类型对象,适用于 引用类型 值类型 接口类型 委托类型 具有泛型类型参 ...

  3. ts中基本数据类型(上)

      /* 定义数组*/ var arr: number[] = [1, 2, 3]; var arr1: Array<number> = [1, 2, 3]; var arr2: [str ...

  4. MongoDB3.6版本新增特性

    MongoDB3.6版新特性如下: (1)Default Bind to Localhost 从3.6版本开始,在默认情况下,MongoDB二进制文件mongod和mongos绑定到localhost ...

  5. cf938D

    题意简述:n个点m条边的无向图,有点权,有边权, 对于每一个点计算,d(i,j)表示点i到点j的最短路 题解:边权扩大二倍,建立源点,然后源点向每一个点x连接一条权值为a[x]的边,然后跑最短路即可 ...

  6. SQL Server远程数据库操作(备份、还原等)

    · SQL Server远程数据库备份到本地: exp sauser/sapassword@192.168.8.233:1433/DBName file=d:/backup.dmp OWNER=sum ...

  7. Android数据存储之SD卡文件操作

    赶上智能手机刚问世时有幸用过的小伙伴都知道,那时候的Android系统是把我们自己买的SD卡作为外部存储的,但是不知道从哪天开始,SD卡就被固化到智能手机的内部了,但是我们仍然把它称为外部存储.我想A ...

  8. PIE-SDK For C++ Geometry的坐标转换

    1. 基于SpatialReference对象的坐标转换 1.1 示例简介 Geometry类是所有几何形体对象的父类,它是一个抽象类,IGeometry接口定义了所有的几何对象都有的方法和属性. 下 ...

  9. tcp_demo

    代码讲解: server import socket def main(): # 创建tcp服务器套接字 tcp_server = socket.socket(socket.AF_INET, sock ...

  10. 让bat文件自动以管理员身份运行

    · 让bat文件自动以管理员身份运行 如何让bat文件自动以管理员身份运行,将这段写在bat文件的前头即可 : %1 mshta vbscript:CreateObject("Shell.A ...