QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#180345 | #7247. Hans Zimmer | mendicillin2 | AC ✓ | 12ms | 18944kb | C++17 | 1.1kb | 2023-09-15 18:28:38 | 2023-09-15 18:28:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <class T> int sz(T&& a) { return int(size(forward<T>(a))); }
template <class T> using vc = vector<T>;
template <class T> using vvc = vc<vc<T>>;
using ll = int64_t;
using vi = vc<int>;
template <class F>
struct ycr {
F f;
template <class T>
explicit ycr(T&& f_) : f(forward<T>(f_)) {}
template <class... Args>
decltype(auto) operator()(Args&&... args) {
return f(ref(*this), forward<Args>(args)...);
}
};
template <class F>
decltype(auto) yc(F&& f) {
return ycr<decay_t<F>>(forward<F>(f));
}
using D = double;
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
cout << fixed << setprecision(42);
int W, H, N; cin >> W >> H >> N;
vector<D> logs(N+2);
for (int a = 1; a <= N+1; a++) {
logs[a] = log(a);
}
vector<D> fact(N+1);
for (int i = 1; i <= N; i++) {
fact[i] = fact[i-1] + logs[i];
}
const D c = fact[N] + log(H) + log(W) - N * log(2);
D ans = 0.;
for (int k = 0; k <= N; k++) {
ans += exp(c - fact[k] - fact[N-k] - 2 * (logs[k+1] + logs[N-k+1]));
}
cout << ans << '\n';
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4136kb
input:
2 4 1
output:
1.999999999999999555910790149937383830547333
result:
ok jury = 2, participant = 2, relative error = 2.220446049e-16
Test #2:
score: 0
Accepted
time: 0ms
memory: 4328kb
input:
42 24 2
output:
87.500000000000014210854715202003717422485352
result:
ok jury = 87.5, participant = 87.5, relative error = 1.624097682e-16
Test #3:
score: 0
Accepted
time: 0ms
memory: 4204kb
input:
1 1 5
output:
0.009201388888888894362905190860146831255406
result:
ok jury = 0.009201388889, participant = 0.009201388889, relative error = 1.207486941e-11
Test #4:
score: 0
Accepted
time: 0ms
memory: 4228kb
input:
1 1 1
output:
0.250000000000000055511151231257827021181583
result:
ok jury = 0.25, participant = 0.25, relative error = 2.220446049e-16
Test #5:
score: 0
Accepted
time: 0ms
memory: 4076kb
input:
1 1000 1
output:
249.999999999999886313162278383970260620117188
result:
ok jury = 250, participant = 250, relative error = 4.547473509e-16
Test #6:
score: 0
Accepted
time: 0ms
memory: 4196kb
input:
1000 1 1
output:
249.999999999999886313162278383970260620117188
result:
ok jury = 250, participant = 250, relative error = 4.547473509e-16
Test #7:
score: 0
Accepted
time: 0ms
memory: 4228kb
input:
1000 1000 1
output:
249999.999999999825377017259597778320312500000000
result:
ok jury = 250000, participant = 250000, relative error = 6.98491931e-16
Test #8:
score: 0
Accepted
time: 0ms
memory: 4204kb
input:
1 1000 5
output:
9.201388888888896389062210801057517528533936
result:
ok jury = 9.201388889, participant = 9.201388889, relative error = 1.207470048e-11
Test #9:
score: 0
Accepted
time: 0ms
memory: 4288kb
input:
1000 1000 5
output:
9201.388888888897781725972890853881835937500000
result:
ok jury = 9201.388889, participant = 9201.388889, relative error = 1.207448735e-11
Test #10:
score: 0
Accepted
time: 0ms
memory: 4128kb
input:
1 1 10
output:
0.000939123342817266477423887582887118696817
result:
ok jury = 0.0009391233428, participant = 0.0009391233428, relative error = 1.838572306e-11
Test #11:
score: 0
Accepted
time: 0ms
memory: 4292kb
input:
1 1 2
output:
0.086805555555555552471602709374565165489912
result:
ok jury = 0.08680555556, participant = 0.08680555556, relative error = 5.120000423e-11
Test #12:
score: 0
Accepted
time: 0ms
memory: 4176kb
input:
1 1 3
output:
0.036458333333333342585191871876304503530264
result:
ok jury = 0.03645833333, participant = 0.03645833333, relative error = 9.142876932e-11
Test #13:
score: 0
Accepted
time: 0ms
memory: 4288kb
input:
1 1 4
output:
0.017442129629629630344078705661559069994837
result:
ok jury = 0.01744212963, participant = 0.01744212963, relative error = 2.123424197e-11
Test #14:
score: 0
Accepted
time: 0ms
memory: 4196kb
input:
1 1 100
output:
0.000000150787287941244525323923413549775940
result:
ok jury = 1.507872879e-07, participant = 1.507872879e-07, relative error = 2.735278479e-10
Test #15:
score: 0
Accepted
time: 0ms
memory: 4248kb
input:
1000 1000 100
output:
0.150787287941244435574006388378620613366365
result:
ok jury = 0.1507872879, participant = 0.1507872879, relative error = 2.735271992e-10
Test #16:
score: 0
Accepted
time: 0ms
memory: 4216kb
input:
1 1 1000
output:
0.000000000015904398692177011272127738922231
result:
ok jury = 1.590439869e-11, participant = 1.590439869e-11, relative error = 1.36881008e-10
Test #17:
score: 0
Accepted
time: 0ms
memory: 4144kb
input:
1000 1000 1000
output:
0.000015904398692179716305345610338761730418
result:
ok jury = 1.590439869e-05, participant = 1.590439869e-05, relative error = 1.370512246e-10
Test #18:
score: 0
Accepted
time: 1ms
memory: 4204kb
input:
1 1 10000
output:
0.000000000000001599040399360055102474613548
result:
ok jury = 1.5990404e-15, participant = 1.599040399e-15, relative error = 4.002055677e-10
Test #19:
score: 0
Accepted
time: 1ms
memory: 4364kb
input:
1000 1000 10000
output:
0.000000001599040399360328012830146621301060
result:
ok jury = 1.5990404e-09, participant = 1.599040399e-09, relative error = 4.000349226e-10
Test #20:
score: 0
Accepted
time: 3ms
memory: 4840kb
input:
1 1 100000
output:
0.000000000000000000159990400774855160133439
result:
ok jury = 1.599904004e-19, participant = 1.599904008e-19, relative error = 2.342985294e-09
Test #21:
score: 0
Accepted
time: 2ms
memory: 4832kb
input:
1000 1000 100000
output:
0.000000000000159990400774882503574668670902
result:
ok jury = 1.599904004e-13, participant = 1.599904008e-13, relative error = 2.343156232e-09
Test #22:
score: 0
Accepted
time: 12ms
memory: 18944kb
input:
1 1 1000000
output:
0.000000000000000000000015999899703885357818
result:
ok jury = 1.5999904e-23, participant = 1.59998997e-23, relative error = 2.685087762e-07
Test #23:
score: 0
Accepted
time: 12ms
memory: 18944kb
input:
1000 1000 1000000
output:
0.000000000000000015999899703888089902552282
result:
ok jury = 1.5999904e-17, participant = 1.59998997e-17, relative error = 2.685086054e-07
Test #24:
score: 0
Accepted
time: 3ms
memory: 5304kb
input:
1 1 123456
output:
0.000000000000000000068873169667026523851654
result:
ok jury = 6.887316951e-20, participant = 6.887316967e-20, relative error = 2.279937484e-09
Test #25:
score: 0
Accepted
time: 3ms
memory: 5312kb
input:
1000 1000 123456
output:
0.000000000000068873169667038281453667879337
result:
ok jury = 6.887316951e-14, participant = 6.887316967e-14, relative error = 2.280108148e-09
Test #26:
score: 0
Accepted
time: 9ms
memory: 10244kb
input:
1 1 424243
output:
0.000000000000000000000493918252441855713204
result:
ok jury = 4.939182799e-22, participant = 4.939182524e-22, relative error = 5.559248447e-08
Test #27:
score: 0
Accepted
time: 3ms
memory: 10228kb
input:
1000 1000 424243
output:
0.000000000000000493918252441940297158285098
result:
ok jury = 4.939182799e-16, participant = 4.939182524e-16, relative error = 5.55923132e-08
Test #28:
score: 0
Accepted
time: 0ms
memory: 4200kb
input:
1 1 20
output:
0.000075373148730557314243887201410387888245
result:
ok jury = 7.537314873e-05, participant = 7.537314873e-05, relative error = 7.39415274e-12
Test #29:
score: 0
Accepted
time: 0ms
memory: 4296kb
input:
1 1 30
output:
0.000016297106403207015524331469080721035425
result:
ok jury = 1.62971064e-05, participant = 1.62971064e-05, relative error = 1.9678437e-10
Test #30:
score: 0
Accepted
time: 0ms
memory: 4212kb
input:
1 1 50
output:
0.000002276822827798275044035736930370106279
result:
ok jury = 2.276822828e-06, participant = 2.276822828e-06, relative error = 8.859939784e-11
Test #31:
score: 0
Accepted
time: 0ms
memory: 4264kb
input:
1 1 200
output:
0.000000009706149111968632362988383178482865
result:
ok jury = 9.706149112e-09, participant = 9.706149112e-09, relative error = 3.231801081e-12
Test #32:
score: 0
Accepted
time: 0ms
memory: 4140kb
input:
1 1 300
output:
0.000000001936345230040427095315441996222286
result:
ok jury = 1.93634523e-09, participant = 1.93634523e-09, relative error = 2.08781012e-11
Test #33:
score: 0
Accepted
time: 0ms
memory: 4272kb
input:
1 1 500
output:
0.000000000252953433128656416061736892785406
result:
ok jury = 2.529534331e-10, participant = 2.529534331e-10, relative error = 1.132873794e-10
Test #34:
score: 0
Accepted
time: 0ms
memory: 4276kb
input:
1 1 700
output:
0.000000000066071093967691083817198072111439
result:
ok jury = 6.607109397e-11, participant = 6.607109397e-11, relative error = 3.494598689e-11
Test #35:
score: 0
Accepted
time: 0ms
memory: 4304kb
input:
1 1 2000
output:
0.000000000000997006239755093934095259631997
result:
ok jury = 9.970062398e-13, participant = 9.970062398e-13, relative error = 4.504089382e-11
Test #36:
score: 0
Accepted
time: 0ms
memory: 4236kb
input:
1 1 3000
output:
0.000000000000197136350573328297793891328409
result:
ok jury = 1.971363506e-13, participant = 1.971363506e-13, relative error = 1.352957112e-10
Test #37:
score: 0
Accepted
time: 0ms
memory: 4308kb
input:
1 1 5000
output:
0.000000000000025569305584994925801833957601
result:
ok jury = 2.556930558e-14, participant = 2.556930558e-14, relative error = 1.953484908e-10
Test #38:
score: 0
Accepted
time: 1ms
memory: 4300kb
input:
1 1 7000
output:
0.000000000000006658181538701516184637749969
result:
ok jury = 6.658181538e-15, participant = 6.658181539e-15, relative error = 1.053614797e-10
Test #39:
score: 0
Accepted
time: 1ms
memory: 4200kb
input:
1 1 20000
output:
0.000000000000000099970006197657549775850623
result:
ok jury = 9.997000625e-17, participant = 9.99700062e-17, relative error = 5.235815365e-10
Test #40:
score: 0
Accepted
time: 1ms
memory: 4292kb
input:
1 1 30000
output:
0.000000000000000019749136371023843380789987
result:
ok jury = 1.974913635e-17, participant = 1.974913637e-17, relative error = 1.064544911e-09
Test #41:
score: 0
Accepted
time: 0ms
memory: 4312kb
input:
1 1 50000
output:
0.000000000000000002559692818829969825261217
result:
ok jury = 2.559692826e-18, participant = 2.559692819e-18, relative error = 2.801129208e-09
Test #42:
score: 0
Accepted
time: 2ms
memory: 4508kb
input:
1 1 70000
output:
0.000000000000000000666331886585248049637489
result:
ok jury = 6.663318889e-19, participant = 6.663318866e-19, relative error = 3.473872452e-09
Test #43:
score: 0
Accepted
time: 2ms
memory: 6484kb
input:
1 1 200000
output:
0.000000000000000000009999700050335840772158
result:
ok jury = 9.999700006e-21, participant = 9.99970005e-21, relative error = 4.433717008e-09
Test #44:
score: 0
Accepted
time: 3ms
memory: 7964kb
input:
1 1 300000
output:
0.000000000000000000001975269031135639739672
result:
ok jury = 1.975269136e-21, participant = 1.975269031e-21, relative error = 5.308864418e-08
Test #45:
score: 0
Accepted
time: 7ms
memory: 10976kb
input:
1 1 500000
output:
0.000000000000000000000255996926794813762363
result:
ok jury = 2.55996928e-22, participant = 2.559969268e-22, relative error = 4.707815309e-09
Extra Test:
score: 0
Extra Test Passed