LibreOJ6162(美团 CodeM 初赛 Round A)[身体训练]--期望

【链接】
libreoj6162

【解题报告】

根据题目意思可知对于第 i 个人在第j位的概率为 1n ,而此次这人所用的时间为 nuci(j1)div ,所以期望就是 uci(j1)div ,直接枚举 i ,j累计期望就行了。

#include<cstdio>
using namespace std;
const int maxn=1005;
int n;
double ans,v,u,a[maxn],b[maxn];
inline int Read()
{
    int res=0;
    char ch=getchar();
    while (ch<'0'||ch>'9') ch=getchar();
    while (ch>='0'&&ch<='9') res=res*10+ch-48,ch=getchar();
    return res;
}
int main()
{
    freopen("6162.in","r",stdin);
    freopen("6162.out","w",stdout);
    n=Read(); scanf("%lf%lf",&v,&u);
    for (int i=1; i<=n; i++) scanf("%lf",&a[i]),a[i]-=v;
    for (int i=1; i<=n; i++) scanf("%lf",&b[i]);
    for (int i=1; i<=n; i++)
     for (int j=1; j<=n; j++)
      ans+=u/(a[i]-(j-1)*b[i]);
    printf("%.3lf",ans);
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值