题目描述
Given the value of low, high you will have to find the value of the following expression:
If you try to find the value of the above expression in a straightforward way, the answer may be incorrect due to precision error.
输入
The input file contains at most 2000 lines of inputs. Each line contains two integers which denote the value of low, high (1 ≤ low ≤ high ≤ 2000000000 and high-low ≤ 10000). Input is terminated by a line containing two zeroes. This line should not be processed.
输出
For each line of input produce one line of output. This line should contain the value of the expression above in exponential format. The mantissa part should have one digit before the decimal point and be rounded to five digits after the decimal point. To be more specific the output should be of the form d.dddddE-ddd, here d means a decimal digit and E means power of 10. Look at the output for sample input for details. Your output should follow the same pattern as shown below.
input
1 100
10000 20000
0 0
output
3.83346E-015
5.60041E-015
题意:
简单的来说就是根据那个公式去计算这个值,给你的是一个上、下限,然后根据这个求这个答案,然后最后的答案就要根据科学计数法来保四舍五入留最后5位
分析:
这样来看,好像没有什么思路(大佬看到这就可以走了d=====( ̄▽ ̄*)b),但是,小伙伴们对求导的定义式是否有什么印象呢????
下面我就将求导的定义式及其求导的过程给各位搬过来了( ̄▽ ̄):
考察下面(二元函数导数)的定义:
lim
△
t
→
0
△
f
△
t
=
lim
△
t
→
0
f
(
x
+
△
t
)
−
f
(
x
)
△
t
=
f
(
x
)
′
\begin{matrix} \lim_{\triangle t \to \ 0} \frac{\triangle f}{\triangle t}=\end{matrix} \begin{matrix} \lim_{\triangle t \to \ 0} \frac{f(x+\triangle t)-f(x)}{\triangle t}=\end{matrix}f(x)\prime
lim△t→ 0△t△f=lim△t→ 0△tf(x+△t)−f(x)=f(x)′
如果我们上述的题目所给的式子看成
f
(
x
)
=
(
x
3
)
f(x)=(\sqrt[3]{x})
f(x)=(3x)
△
t
=
1
0
−
15
\triangle t = 10^{-15}
△t=10−15
这一题是不是就可以看成从题目给的下限到上限的求导的和了呢(最后的答案应该需要乘上
△
t
\triangle t
△t
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <cstring>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
const int N = 1e6+10;
const int INF=0x3f3f3f3f;
const ll LINF=0x3f3f3f3f3f3f3f3f;
const int MOD=1e9+7;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define Abs(x) ((x)>=0?(x):-(x))
double low,up;
int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif // ONLINE_JUDGE
while(scanf("%lf%lf",&low,&up)!=EOF,low+up){
double t=1e-15;
double ans=0;
for(double i=low;i<=up;i++){
ans+=pow(i,-0.66666666666);
}
ans*=0.333333333;
printf("%.5fE-015\n",ans);
}
return 0;
}
emmmmm,排版没有排好,下次改进ε=ε=ε=( ̄▽ ̄)