概率

部署运行你感兴趣的模型镜像
I - I
Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu

Description

Sometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a party where there are 23 people including you. What is the probability that at least two people in the party have same birthday? Surprisingly the result is more than 0.5. Now here you have to do the opposite. You have given the number of days in a year. Remember that you can be in a different planet, for example, in Mars, a year is 669 days long. You have to find the minimum number of people you have to invite in a party such that the probability of at least two people in the party have same birthday is at least 0.5.

Input

Input starts with an integer T (≤ 20000), denoting the number of test cases.

Each case contains an integer n (1 ≤ n ≤ 105) in a single line, denoting the number of days in a year in the planet.

Output

For each case, print the case number and the desired result.

Sample Input

2

365

669

Sample Output

Case 1: 22

Case 2: 30

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<cstdio>
int main()
{
	int t,k=1,n;
	double z;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		int m=0;
		z=1.0;
		for(int i=0;i<=100000;i++)
		{
			z*=double(n-i)/n;
			m++;
			if(1.0-z>=0.5)
			break;
		}
		printf("Case %d: %d\n",k++,m-1);
	}
	return 0;
}


您可能感兴趣的与本文相关的镜像

Linly-Talker

Linly-Talker

AI应用

Linly-Talker是一款创新的数字人对话系统,它融合了最新的人工智能技术,包括大型语言模型(LLM)、自动语音识别(ASR)、文本到语音转换(TTS)和语音克隆技术

一、专家方案 分析往期开奖号码时,通常结合综合走势图及多维度形态指标进行推演,以锁定下期可能开出的号码。其中核心参考指标包括:冷热号、奇偶分布、012路分布,以及综合走势(新走势总表)、红球分布(红球综合形态)、红球和值(红球和值走势)、红球012路(红球012路分布)、红球跨度(红球跨度走势)、尾数分组(红球尾数分组走势)、红球连号(红球连号分布)、蓝球综合(蓝球综合分布)、红球号码分布、红球大小奇偶综合分布、红球和尾(红球和值尾数走势)、012路个数(红球012路个数分布)、尾数综合(红球尾数综合走势)、红球头尾(红球头尾号走势图)、和值尾数(红球和值尾数3D分析)、蓝球尾数(蓝球尾数综合走势)等。 二、预测项目 金胆、三胆、杀3红、杀6红、龙头、凤尾、20码推荐、五码定蓝、一码定蓝、杀蓝、三区比、奇偶比、12+4复式、9+3复式、8+3复式、7+2复式、单式号码。 三、数据统计指标 出现次数:号码在统计期内实际开出的总次数; 出现概率:出现次数 ÷ 统计期数; 理论概率:号码理论上的出现概率概率偏差:出现概率 - 理论概率; 平均遗漏:统计期内号码遗漏值之和 ÷ 出现次数; 最大遗漏:统计期内号码最长未开出的期数; 上次遗漏:号码最后一次开出时的遗漏期数; 本次遗漏:号码截至当前的遗漏期数; 欲出机率:当前遗漏 ÷ 平均遗漏。
最新发布
11-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值