QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#545871 | #9136. Exponent Calculator | Siwu# | AC ✓ | 0ms | 3796kb | C++17 | 1.9kb | 2024-09-03 17:48:46 | 2024-09-03 17:48:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
double ex1(double x){
double tt=256;
x/=tt;
double ans=x*1.0/8;
for(int i=7;i>=1;i--){
ans=ans+1.0/i;
ans=ans*x;
}
ans=ans+1.0;
for(int i=0;i<8;i++)ans=ans*ans;
// double p=1;
// for(int i=0;i<=8;i++){
// ans+=pow(x,i)/p;
// p*=(i+1);
// }
return ans;
}
double ex(double x){
double tt=256;
x/=tt;
double ans=0;
double p=1;
for(int i=0;i<=7;i++){
ans+=pow(x,i)/p;
p*=(i+1);
}
for(int i=0;i<8;i++)ans=ans*ans;
return ans;
}
void solve(){
int fac[10];
fac[0]=1;
for(int i=1;i<10;i++)fac[i]=fac[i-1]*i;
// for(int i=-20;i<=20;i++){
// cout<<(exp(i)-ex(i))/min(exp(i),ex1(i))<<"\n";
// }
cout<<fixed<<setprecision(30);
cout<<"25\n";
cout<<fixed<<"$1 = $1 * "<<1.0/256<<"\n";
cout<<fixed<<"$0 = $1 * "<<1.0/fac[8]<<"\n";
cout<<fixed<<"$0 = $0 + "<<1.0/fac[7]<<"\n";
cout<<"$0 = $1 * $0\n";
cout<<fixed<<"$0 = $0 + "<<1.0/fac[6]<<"\n";
cout<<"$0 = $1 * $0\n";
cout<<fixed<<"$0 = $0 + "<<1.0/fac[5]<<"\n";
cout<<"$0 = $1 * $0\n";
cout<<fixed<<"$0 = $0 + "<<1.0/fac[4]<<"\n";
cout<<"$0 = $1 * $0\n";
cout<<fixed<<"$0 = $0 + "<<1.0/fac[3]<<"\n";
cout<<"$0 = $1 * $0\n";
cout<<fixed<<"$0 = $0 + "<<1.0/fac[2]<<"\n";
cout<<"$0 = $1 * $0\n";
cout<<fixed<<"$0 = $0 + "<<1.0<<"\n";
cout<<"$0 = $1 * $0\n";
cout<<fixed<<"$0 = $0 + "<<1.0<<"\n";
cout<<"$0 = $0 * $0\n";
cout<<"$0 = $0 * $0\n";
cout<<"$0 = $0 * $0\n";
cout<<"$0 = $0 * $0\n";
cout<<"$0 = $0 * $0\n";
cout<<"$0 = $0 * $0\n";
cout<<"$0 = $0 * $0\n";
cout<<"$0 = $0 * $0\n";
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n=1;
//cin>>n;
while(n--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
input
output:
25 $1 = $1 * 0.003906250000000000000000000000 $0 = $1 * 0.000024801587301587301565789639 $0 = $0 + 0.000198412698412698412526317115 $0 = $1 * $0 $0 = $0 + 0.001388888888888888941894328433 $0 = $1 * $0 $0 = $0 + 0.008333333333333333217685101602 $0 = $1 * $0 $0 = $0 + 0.041666666666666664353702032031 ...
result:
ok max relative diff is 1.14643e-13. Checker runtime is 208 ms
Extra Test:
score: 0
Extra Test Passed