题解 | 小天的 Minecraft

小天的 Minecraft

https://www.nowcoder.com/practice/be38c66dca1941088b92f3ebbdcde882

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll  fac[17];


ll C(int n,int m)
{
    return fac[n]/fac[n-m]/fac[m];
}

void solve()
{
    
    double a,b,c;
    cin>>a>>b>>c;
    double res = 0;
    res = C(16,16)*pow(a/16,16);
    // printf("%.10lf\n",res);
    res +=C(16,12)*pow(a/16,12)*pow(b/16,4);
    // printf("%.10lf\n",res);
    res +=C(16,12)*pow(a/16,12)*pow(c/16,4);
    
    printf("%.10lf\n",res);



}


int main()
{
    fac[0]=1;
    for(int i=1;i<=16;i++)fac[i]=fac[i-1]*i;
    int _;
    cin>>_;
    while(_--)
    {
        solve();
    }
    return 0;
}

数学题这一块

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务