Research Productivity Index

Research Productivity Index

 Kattis - researchproductivityindex 

Angela is a new PhD student and she is nervous about the upcoming paper submission deadline of this year’s research conference. She has been working on multiple projects throughout the past year. Luckily most of the projects concluded successfully, and she came up with nncandidate papers. However not all of the papers were born equal—some have better results than others. Her advisor believes she should only submit the papers with “good enough” results so they have a high chance of getting accepted.

Angela’s research group has a unique way of evaluating the success of paper submissions. They use the research productivity index, defined as aa/saa/s, where ss is the total number of papers submitted, and aa is the number of papers that are accepted by the conference. When a=0a=0, the index is defined to be zero. For example:

  • if one paper is submitted and it gets accepted, the index is 11/1=111/1=1;

  • if 44 papers are submitted and all get accepted, the index is 44/4=444/4=4;

  • if 1010 papers are submitted and 33 get accepted, the index is 33/10≈1.39038933/10≈1.390389;

  • if 55 papers are submitted and 44 get accepted, the index is 44/5≈3.03143344/5≈3.031433;

  • if 33 papers are submitted and all get rejected (a=0a=0), the index is 00.

Intuitively, to get a high research productivity index one wants to get as many papers accepted as possible while keeping the acceptance rate high.

For each of her nn papers, Angela knows exactly how likely it is that the conference would accept the paper. If she chooses wisely which papers to submit, what is the maximum expected value of her research productivity index?

Input

The first line of the input has a single integer nn (1≤n≤1001≤n≤100), the number of Angela’s candidate papers. The next line has nn space-separated integers giving the probability of each paper getting accepted. Each probability value is given as an integer percentage between 11 and 100100, inclusive.

Output

Output the maximum expected value of Angela’s research productivity index. Your answer is considered correct if it has an absolute or relative error of no more than 10−610−6.

Sample Input 1Sample Output 1
5
30 50 70 60 90
2.220889579
Sample Input 2Sample Output 2
6
30 90 30 90 30 90
2.599738456
Sample Input 3Sample Output 3
4
10 10 10 10
0.368937005

 每次上交概率最大的1~n张试卷,求最大值

#include<bits/stdc++.h>
using namespace std;
double dp[120],a[120];

bool cmp(double numa,double numb)
{
    return numa>numb;
}
int main()
{
    int i,j,m,n,k,top,base;
    double ans,tmp;
    scanf("%d",&n);
    for(i = 1; i <= n; i++)
    {
        scanf("%lf",&a[i]);
        a[i]/=100;
    }
    sort(a+1,a+n+1,cmp);
    ans = 0;
    for(i = 1; i<=n; i++)
    {
        if(a[i]==1)

            base = i;
        else
            break;
    }
    for(k = 0; k< n; k++)
    {
        memset(dp,0,sizeof(dp));
        for(i = 0; i<= base; i++)
        {
            dp[base] = 1;

        }
        top = n-k;
        for(i = base+1; i <= top; i++)
        {
            dp[base]*=(1-a[i]);
        }
        for(i = base+1; i <= top; i++)//求二项分布有k次实验成功时的dp
        {
            for(j = i-1; j>=base; j--)
            {
                dp[j+1]+= dp[j]/(1-a[i])*a[i];
            }
        }

        tmp = 0;
        for(i = 1; i<= top; i++)
        {
            tmp += pow(i*1.0,i*1.0/(top*1.0))*dp[i];
        }
        ans = max(ans,tmp);
    }
    printf("%.9lf\n",ans);
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值