题意:假设一年有n天,问至少有多少个人,能保证至少其中两个人的生日在同一天的概率大于等于0.5。
题解:要计算至少两个人的生日同天概率可以逆着算所有人不同天生日的概率小于0.5,那么人数就是x = 1 * (n - 1)/n * (n-2)/n * … 直到x是小于0.5的。

#include <stdio.h>
#include <string.h>
#include <math.h>
int n;

int main() {
    int t, cas = 1;
    scanf("%d", &t);
    while (t--) {
        scanf("%d", &n);
        int cnt = 1;
        double temp = 1;
        while (temp > 0.5) {
            temp *= (n - cnt) * 1.0 / n;
            cnt++;
        }
        printf("Case %d: %d\n", cas++, cnt - 1);
    }
    return 0;
}