QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#545862#9136. Exponent CalculatorMu_SilkAC ✓0ms3908kbC++201.9kb2024-09-03 17:46:342024-09-03 17:46:35

Judging History

你现在查看的是最新测评结果

  • [2024-09-03 17:46:35]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3908kb
  • [2024-09-03 17:46:34]
  • 提交

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;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3908kb

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 203 ms

Extra Test:

score: 0
Extra Test Passed