QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#494877 | #9136. Exponent Calculator | ucup-team052# | AC ✓ | 0ms | 3912kb | C++23 | 1.0kb | 2024-07-27 17:25:18 | 2024-07-27 17:25:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int n=21;
void test()
{
const double X=20;
double x=X;
// double w=1+x/(1<<n);
double w=(1+x/(1<<n));
double y=w;
for(int i=1;i<=n;++i)y=y*y;
// printf("%.20lf\n",y*(1+x*x/(1<<(n+1))+x*x*x*x/pow(2,n*2+3)));
y=y*pow(w,x/2);
printf("%.20f\n",y);
printf("%.20f\n",pow(1+x*((1<<n)+x/2)/pow(2,n*2),(1<<n)));
printf("%.20lf\n",exp(X));
}
void test2()
{
const double X=20;
double x1=X;
double x3=x1+(1<<(n+1));
double x4=x1*x3;
double x5=x4*pow(0.5,n*2+1);
double x6=x5+1;
for(int i=1;i<n;i++)
{
x6=x6*x6;
}
double x0=x6*x6;
printf("%.20lf\n",x0);
printf("%.20lf\n",exp(X));
double y0=x0,y1=exp(X);
printf("%.20f\n",abs(y0-y1)/y1);
}
int main() {
#ifdef xay5421
test2();
return 0;
#endif
cout<<n+4<<endl;
printf("$3 = $1 + %d\n",1<<(n+1));
printf("$4 = $1 * $3\n");
printf("$5 = $4 * %.40lf\n",pow(0.5,n*2+1));
printf("$6 = $5 + 1\n");
for(int i=1;i<n;i++)
{
printf("$6 = $6 * $6\n");
}
printf("$0 = $6 * $6\n");
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3912kb
input:
input
output:
25 $3 = $1 + 4194304 $4 = $1 * $3 $5 = $4 * 0.0000000000001136868377216160297393798828 $6 = $5 + 1 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $6 * $6 $6 = $...
result:
ok max relative diff is 7.13427e-10. Checker runtime is 189 ms
Extra Test:
score: 0
Extra Test Passed