Lightoj 1104-birthday Paradox "probability"

Source: Internet
Author: User

Title Link: http://www.lightoj.com/volume_showproblem.php?problem=1104
Test instructions: Birthday refutation, ask for the minimum number of people to meet the conditions
Code:

#include <stdio.h>#include <iostream>#include <string.h>#include <algorithm>#include <bitset>#include <math.h>#include <ctype.h>#include <time.h>#include <queue>#include <map>#include <set>using namespace STD;intTintNintdp[100010];intMain () {Cin>> T; for(intCA =1; CA <= T; ca++) {memset(DP,0,sizeof(DP));Cin>> N;cout<<"Case"<< CA <<": ";if(n = =1)cout<<1<< Endl;Else{DoubleAns =1.0;intI for(i =1; I <= N; i++) {ans *= (n-i) *1.0/n);if(Ans <=0.5) Break; }cout<< i << Endl; }    }return 0;}

Lightoj 1104-birthday Paradox "probability"

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.