ACM模版

描述

题解

这场比赛的期望概率成分好高,挺不顺手。

不过这个题的代码倒是很简单,强势猜公式推结论。

ans=1+log(L / d)L>d

代码

#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

double L, d;

int main()
{
    int N;
    cin >> N;

    while (N--)
    {
        cin >> L >> d;

        if (L <= d)
        {
            cout << "0.000000\n";
        }
        else
        {
            printf("%.6f\n", 1 + log(L / d));
        }
    }

    return 0;
}