sdnu oj 1320 The Hard Choice

果然还是要认真分类讨论啊2333
举个例子就明白了
在这里插入图片描述
这是一份只过了样例的代码, 谜之超时

#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <math.h>
using namespace std;

typedef long long ll;
const int N = 10000006;

int main()
{
    int cow, car, show;
    while(~scanf("%d%d%d", &cow, &car, &show))
    {
        int tot = cow + car;
        int tot2 = cow + car - show - 1;
        double ans = (double)(cow*car + car*(car-1)) / (tot*tot2);
        printf("%.5lf\n", ans);
    }
    return 0;
}

发布了40 篇原创文章 · 获赞 4 · 访问量 1131

猜你喜欢

转载自blog.csdn.net/xiongshuxian2019/article/details/104425571