Hdu5035: Probability Theory

Source: Internet
Author: User

Question:

You have to send a package to the post office. There are n windows, each of which has a number of people. The TI distribution at each window is in line with the geometric distribution: Ki * E ^ (-ki * t)

The current service has performed CI time in each window.

You will go to the first window to complete the current service. Please expect the total time from arriving at the post office to sending the package

 

It is said to be a question in the probability theory book .. Probability Theory has learned a chapter about crying

The question was not completely clear during the competition. I felt that the probability should be calculated using points, so I started to point the question. After a long time, I could not know it.

After reading the topic of Daniel, I finally understood it. I also pushed the cursor + ∞ XF (X: λ J) dx once ..

 

Ideas:

First, the probability integral + ∞ XF (X: λ J) dx integral + ∞ XF (X: λ J) DX success + ∞ XF (X: λ J) dx returns the probability that the completion time is within [0, T] 1-E ^ (-ki * t), so [t, + ∞] the probability is e ^ (-ki * t );

Then obtain the expected credits E (I) = 1/ki;

The time for completing the current service in each window is irrelevant to the Time CI that has been performed (this is calculated by the conditional probability)

So when we set the T moment and you came to the I window, what conditions should we meet?

According to the meaning of the question, you will end the Earliest window of the current service. Therefore, it is necessary that other windows do not end their current work at the T moment.

This probability can be easily written out by the multiplication principle:

That is, merge (j = 1... n, J! = I): E ^ (-KJ * t ).

The time spent is T (the time spent on the current service) + E (I) (the expectation of the time spent on you ).

Because t is continuous, you also need to credit T.

Finally, sum each window to get the expected expression.

The process of simplification requires various points .. Therefore, high data skills are very important.

 

Finally, the formula is introduced .. The code is easy to write.

#include <iostream>#include <stdio.h>#include<string.h>#include<algorithm>#include<math.h>#include<string>#include<ctype.h>using namespace std;#define MAXN 10000double k[1010];int main(){    int tt;    scanf("%d",&tt);    int n;    int cas=0;    while(tt--)    {        cas++;        scanf("%d",&n);        double ans=0;        for(int i=0;i<n;i++)        {            scanf("%lf",k+i);            ans+=k[i];        }        for(int i=0;i<n;i++)        {            scanf("%lf",&k[1000]);        }        printf("Case #%d: %.6f\n",cas,(n+1)/ans);    }    return 0;}

 

Hdu5035: Probability Theory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.