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

Now please try your lucky.

Input

The 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);

Output

For 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<cstdio>
#include<string>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<cstring>
#include<set>
#include<queue>
#include<algorithm>
#include<vector>
#include<map>
#include<cctype>
#include<stack>
#include<sstream>
#include<list>
#include<assert.h>
#include<bitset>
#include<numeric>
#define debug() puts("++++")
#define gcd(a,b) __gcd(a,b)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define fi first
#define se second
#define pb push_back
#define sqr(x) ((x)*(x))
#define ms(a,b) memset(a,b,sizeof(a))
#define sz size()
#define be begin()
#define pu push_up
#define pd push_down
#define cl clear()
#define lowbit(x) -x&x
#define all 1,n,1
#define rep(i,x,n) for(int i=(x); i<(n); i++)
#define in freopen("in.in","r",stdin)
#define out freopen("out.out","w",stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int,int> P;
const int INF = 0x3f3f3f3f;
const ll LNF = 1e18;
const int maxn = 1e3 + 20;
const int maxm = 1e6 + 10;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int dx[] = {-1,1,0,0,1,1,-1,-1};
const int dy[] = {0,0,1,-1,1,-1,1,-1};
int dir[4][2] = {{0,1},{0,-1},{-1,0},{1,0}};
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
ll quickpow(ll a, ll b) {
ll ans = 0;
while (b > 0) {
if (b % 2)ans = ans * a;
b = b / 2;
a = a * a;
}
return ans;
}
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a%b);
}
bool cmp(int a, int b) {
return a > b;
}
int T;
double y;
double ok(double x)
{
return 8*pow(x,4)+7*pow(x,3)+2*pow(x,2)+3*x+6;
}
int main()
{
scanf("%d",&T);
while(T--)
{
int f=0;
scanf("%lf",&y);
if(ok(0)>y||ok(100)<y)
{
printf("No solution!\n");
continue;
}
//int cas = 100;
double l = 0, r = 100.0;
while(r-l>eps)
{
double mid = (l+r)/2.0;
if(ok(mid)>y)
{
r=mid;
}
else l=mid;
}
printf("%.4f\n",l);
}
}

最新文章

  1. windows 7(32/64位)GHO安装指南(U盘制作篇)~
  2. HTML中object,classid--记录十
  3. 搭建一套自己实用的.net架构(1)【概述】
  4. java多线程-线程创建
  5. Solr常用查询语法笔记
  6. matlab读入矩阵数据
  7. NSURLConnection、NSURLSession
  8. Java SE 6 新特性: HTTP 增强--转
  9. php 联系电话验证(手机和固话)
  10. UDP和多线程服务器
  11. iOS数据解析UI_14
  12. SQL进阶随笔--case用法(一)
  13. 大白话讲解Promise
  14. Jeecg框架简介
  15. java 多线程 28 : 多线程组件之 Semaphore 信号量
  16. aapium 设置安卓机参数
  17. 分布式MySql
  18. React条件性渲染
  19. pt-online-schema-change线上DDL注意事项
  20. sql_autoload_register()函数

热门文章

  1. 静态化技术Freemarker
  2. android 与 小米1S刷机学习
  3. bzoj进度条
  4. 兔子与兔子 [Hash]
  5. [fzu 2282]置换不动点大于等于k的排列数
  6. im4java学习---阅读documentation文档
  7. HDU2571--命运---DP
  8. bzoj2002 弹飞绵羊 分块
  9. phpcms v9 后台添加修改页面空白页问题解决方法
  10. Linux的yum命令——(八)