QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#353218#968. Extreme WealthHKOI0#WA 7ms3892kbC++201.2kb2024-03-13 23:25:302024-03-13 23:25:31

Judging History

你现在查看的是最新测评结果

  • [2024-03-13 23:25:31]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3892kb
  • [2024-03-13 23:25:30]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define int long long

typedef long double LD;

LD log_factorial(int n){
    if (n >= 2e7) return (LD) n * logl(n) - (LD) n + logl(n * acosl(-1) * 2) / 2.0L + logl(1.0L + 1.0L / n / 12 + 1.0L / n / n / 288);
    // if (n >= 2e7) return n * logl(n) - n + logl(1.0L / 30 + (LD) n * (1 + 4 * (LD) n * (1 + (LD) n * 2))) / 6.0L + logl(acosl(-1)) / 2;
    else {
        LD l = 0, r = 0;
        for (int i = 1; i <= n; i++) {
            LD l2 = l + logl(i);
            r += (l2 - l) - logl(i);
            l = l2;
        }
        l += r;
        return l;
    }
}

void solve() {
    int R, B; cin >> R >> B;

    LD l = 0;
    l += logl(2) * (R + B);
    l -= log_factorial(R + B);
    l += log_factorial(R);
    l += log_factorial(B);

    if (l > logl(1e9 + 11) || expl(l) > 1e9) {
        cout << "Extreme Wealth" << endl;
    } else {
        cout << fixed << setprecision(10) << expl(l) << endl;
    }
}

signed main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    int T = 1;
    // cin >> T;
    while (T--) solve();
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3880kb

input:

3 2

output:

3.2000000000

result:

ok OK 3.20000000, real ans = 3.20000000, error = 0.00000000

Test #2:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

0 29

output:

536870912.0000000006

result:

ok OK 536870912.00000000, real ans = 536870912.00000000, error = 0.00000000

Test #3:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

30 0

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1073741824.00000000

Test #4:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

37 73

output:

5028.4888595832

result:

ok OK 5028.48885958, real ans = 5028.48885958, error = 0.00000000

Test #5:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

10000000000 10000000000

output:

177245.3840765427

result:

ok OK 177245.38407654, real ans = 177245.38509055, error = 0.00000001

Test #6:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

10000000000 9999412550

output:

989753713.0317020129

result:

ok OK 989753713.03170204, real ans = 989753719.13242424, error = 0.00000001

Test #7:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

10000000000 9999412400

output:

994124831.0786639518

result:

ok OK 994124831.07866395, real ans = 994124819.34340525, error = 0.00000001

Test #8:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

10000000000 9999412200

output:

999984745.9841491404

result:

ok OK 999984745.98414910, real ans = 999984746.74201429, error = 0.00000000

Test #9:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

10000000000 9999412199

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1000014138.02130949

Test #10:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

10000000000 9999411862

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1009971237.25187039

Test #11:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

10000000000 9999411861

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 1010000939.12199187

Test #12:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

1000000000 100000000

output:

Extreme Wealth

result:

ok OK Extreme Wealth, real ans = 2000288524.07298231

Test #13:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

999900000 999999999

output:

682861.8609640447

result:

ok OK 682861.86096404, real ans = 682861.86152047, error = 0.00000000

Test #14:

score: 0
Accepted
time: 7ms
memory: 3892kb

input:

100000 100500

output:

1046.8242075237

result:

ok OK 1046.82420752, real ans = 1046.82420753, error = 0.00000000

Test #15:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

1000000000000 1000000000000

output:

1772452.2599206536

result:

ok OK 1772452.25992065, real ans = 1772453.85090552, error = 0.00000090

Test #16:

score: -100
Wrong Answer
time: 0ms
memory: 3884kb

input:

1000000000000 999995000000

output:

918168763.0274172861

result:

wrong answer WA 918168763.02741730, real ans = 918167024.49532175, error = 0.00000189