QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#480174 | #4683. Qanat | Geothermal | AC ✓ | 1ms | 3932kb | C++20 | 1.4kb | 2024-07-16 09:19:28 | 2024-07-16 09:19:28 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
const char nl = '\n';
void solve() {
int W, H, N; cin >> W >> H >> N;
ld R = H; R /= W;
ld V = (1-R*R)/2;
ld A[N+2];
A[0] = 0;
A[1] = 1;
FOR(i, 2, N+2) {
A[i] = A[i-1] / V - A[i-2];
}
ld val = W / A[N+1];
F0R(i, N+2) A[i] *= val;
ld ans = 0;
F0R(i, N+1) {
ld cur = (A[i+1] * (1+R) - A[i] * (1-R));
cur *= cur; cur /= 4;
ans += cur;
}
FOR(i, 1, N+1) {
ld cur = A[i] * R;
ans -= cur*cur/2;
}
cout << fixed << setprecision(15) << ans << endl;
FOR(i, 1, min(N+1, 11)) {
cout << A[i] << endl;
}
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
8 4 1
output:
31.500000000000000 3.000000000000000
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
195 65 2
output:
12220.000000000000000 48.000000000000000 108.000000000000000
result:
ok 3 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
10000 1 1000
output:
30141.885677128479598 9.956721203094918 19.913442605324262 29.870164405822463 39.826886803723957 49.783609998163195 59.740334188274644 69.697059573192788 79.653786352052137 89.610514723987229 99.567244888132634
result:
ok 11 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
2 1 5
output:
1.911532555282555 0.029852579852580 0.079606879606880 0.182432432432432 0.406879606879607 0.902579852579853
result:
ok 6 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
10000 9999 1
output:
99989999.750049998758186 0.999950000000000
result:
ok 2 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
10000 1 1
output:
12505000.499999998753083 4999.999950000000000
result:
ok 2 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
10000 51 500
output:
436223.562530668615295 3.891507613976061 7.783217669443703 11.675332618425791 15.568054934008294 19.461587120873216 23.356131725833161 27.251891348368091 31.149068651164827 35.047866370659834 38.948487327585849
result:
ok 11 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
10000 185 500
output:
1587574.056021334228376 0.001060330438760 0.002121386922195 0.003183895992125 0.004248585185009 0.005316183530109 0.006387422048685 0.007463034254548 0.008543756656323 0.009630329261761 0.010723496084450
result:
ok 11 numbers
Test #9:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
1000 995 2
output:
994993.812112480604526 0.024875775038791 4.987624067928006
result:
ok 3 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
10000 1 9
output:
2505001.899999780551752 999.999670000073920 1999.999360000141440 2999.999090000196560 3999.998880000234080 4999.998750000250001 5999.998720000241921 6999.998810000209441 7999.999040000154561 8999.999430000082080
result:
ok 10 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
10000 1 10
output:
2277729.340908798182681 909.090545454644727 1818.181109091100546 2727.271709091178910 3636.362363636692001 4545.453090909453092 5454.543909091276911 6363.634836363980002 7272.725890909381092 8181.817090909301456 9090.908454545565274
result:
ok 11 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
10000 1 11
output:
2088335.569444063774654 833.332936111240871 1666.665888889140630 2499.998875000358501 3333.331911111554371 4166.665013889389131 4999.998200000525002 5833.331486111625872 6666.664888889357632 7499.998425000388502 8333.332111111389372
result:
ok 11 numbers
Test #13:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
5374 23 881
output:
105634.972481495298020 0.312477922019948 0.624967291723996 0.937479557215635 1.250026167437143 1.562618572589027 1.875268224549497 2.187986577294010 2.500785087314890 2.813675214041037 3.126668420257744
result:
ok 11 numbers
Test #14:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
7868 6 86
output:
202023.774414224673819 90.304245826746843 180.608596683215809 270.913157599251175 361.218033604941536 451.523329730741951 541.829151007596110 632.135602467058486 722.442789141416497 812.750816063812662 903.059788268366764
result:
ok 11 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
458 4 583
output:
1567.698163276308046 0.008335238902191 0.016671749462013 0.025010803531107 0.033353673349162 0.041701631738012 0.050055952295825 0.058417909591407 0.066788779358654 0.075169838691186 0.083562366237185
result:
ok 11 numbers
Test #16:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
948 7 778
output:
5676.398722771737646 0.005803904099459 0.011608441125461 0.017414244073569 0.023221946077398 0.029032180477659 0.034845580891225 0.040662781280230 0.046484416021199 0.052311119974236 0.058143528552249
result:
ok 11 numbers
Test #17:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
5964 32 326
output:
164105.039431878681640 7.623164747942140 15.246768433187835 22.871250018314389 30.497048516448061 38.124603016542180 45.754352708659624 53.386736909261127 61.022195086500859 68.661166885530741 76.304092153814950
result:
ok 11 numbers
Test #18:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
9810 46 137
output:
446648.137669328961039 62.055733988696514 124.114196949584807 186.178117974866346 248.250226396767251 310.333251907563811 372.429924679623844 434.542975485469157 496.675135817864411 558.829138009937647 621.007715355337779
result:
ok 11 numbers
Test #19:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
5506 26 889
output:
122360.703323669449482 0.192875062238137 0.385758726290146 0.578659594353518 0.771586269393010 0.964547355524311 1.157551458397775 1.350607185582207 1.543723146948747 1.736907955054850 1.930170225528387
result:
ok 11 numbers
Test #20:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
2274 11 359
output:
21510.311268191568958 2.670186390476050 5.340497745316805 8.011059034735287 10.681995240641421 13.353431362491173 16.025492423136510 18.698303474676449 21.371989604309482 24.046675940187637 26.722487657272459
result:
ok 11 numbers
Test #21:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
709 3 571
output:
1819.356662319423194 0.277079688733435 0.554169299313317 0.831278753941380 1.108417975529949 1.385596888057260 1.662825416922829 1.940113489302867 2.217471034505753 2.494907984327599 2.772434273407883
result:
ok 11 numbers
Test #22:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
8601 87 124
output:
655817.085460414149622 42.346699773365332 84.702065864567276 127.074766365017840 169.473472913642791 211.906862471546018 254.383619097763094 296.912435726467433 339.502015945992763 382.161075780035987 424.898345471404960
result:
ok 11 numbers
Test #23:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
3207 2 638
output:
7649.049651907126558 4.762635959785184 9.525275624155871 14.287922697700443 19.050580885013048 23.813253890696477 28.575945419365048 33.338659175647488 38.101398864189811 42.864168189658206 47.626970856741910
result:
ok 11 numbers
Test #24:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
2971 24 28
output:
114650.014744811556099 100.599972348002850 201.213074957576692 301.852439804048150 402.531202290478782 503.262502962091779 604.059489221369812 704.935317044047880 805.903152696225147 906.976174452819860 1008.167574317591662
result:
ok 11 numbers
Test #25:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
8420 73 940
output:
525973.293386903539215 0.002013818858898 0.004027940482039 0.006042667679183 0.008058303351135 0.010075150535283 0.012093512451158 0.014113692546021 0.016135994540483 0.018160722474170 0.020188180751431
result:
ok 11 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
6704 50 943
output:
286734.448995275810006 0.006702204266827 0.013405154198744 0.020109595543802 0.026816274215983 0.033525936378183 0.040239328525236 0.046957197566957 0.053680290911248 0.060409356547250 0.067145143128560
result:
ok 11 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
4495 24 999
output:
92225.089019317849008 0.035680333888756 0.071362702168285 0.107049139345358 0.142741680158740 0.178442359695209 0.214153213505591 0.249876277720817 0.285613589168024 0.321367185486682 0.357139105244781
result:
ok 11 numbers
Test #28:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
9270 32 846
output:
253507.499227001829013 1.448844802489971 2.897724135055318 4.346672528594367 5.795724515651362 7.244914631239475 8.694277413663871 10.143847405344854 11.593659153641115 13.043747211673086 14.494146139146445
result:
ok 11 numbers
Test #29:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
9865 74 778
output:
624467.914169742236140 0.053917277843099 0.107840623771140 0.161776106551996 0.215729796319471 0.269707765256465 0.323716088278360 0.377760843716718 0.431848114003367 0.485983986354936 0.540174553457947
result:
ok 11 numbers
Test #30:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
6422 52 782
output:
285713.102058474801595 0.018770669335857 0.037543800197076 0.056321854431815 0.075107294533867 0.093902583965585 0.112710187480931 0.131532571448696 0.150372204175933 0.169231556231642 0.188113100770752
result:
ok 11 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
3730 1 509
output:
8770.087570166318231 7.268347283922777 14.536695612681325 21.805046031111568 29.073399584049728 36.341757316332478 43.610120272797092 50.878489498281595 58.146866037624913 65.415250935667024 72.683645237249107
result:
ok 11 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
7689 70 720
output:
460629.101736604580765 0.018410564801140 0.036824181636946 0.055243903048042 0.073672782587041 0.092113875324760 0.110570238356673 0.129044931309706 0.147541016849452 0.166061561187886 0.184609634591672
result:
ok 11 numbers
Test #33:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
8374 17 923
output:
122084.508274122467398 3.404569162681435 6.809166387831723 10.213819738151024 13.618557276802114 17.023407067641702 20.428397175451742 23.833555666170765 27.238910607125214 30.644490067260790 34.050322117373813
result:
ok 11 numbers
Test #34:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
4417 22 938
output:
83064.107687034018170 0.083453754612426 0.166911649957717 0.250377826974190 0.333856427011073 0.417351592033990 0.500867464830470 0.584408189215501 0.667977910237138 0.751580774382161 0.835220929781817
result:
ok 11 numbers
Test #35:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
7222 30 710
output:
185191.636297721483359 1.302507830274685 2.605060612172062 3.907703298866172 5.210480846633818 6.513438216406071 7.816620375319947 9.120072298270294 10.423838969461948 11.727965383962206 13.032496549253684
result:
ok 11 numbers
Test #36:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
3810 19 746
output:
61880.179773479507201 0.276907005731567 0.553827784572319 0.830776110316501 1.107765758128519 1.384810505228102 1.661924131575567 1.939120420557225 2.216413159670953 2.493816141211971 2.771343162958863
result:
ok 11 numbers
Test #37:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
5093 28 582
output:
121927.400380269640259 0.851455817270778 1.702963106886002 2.554573344301733 3.406338011197449 4.258308598588223 5.110536609937468 5.963073564270432 6.815970999288632 7.669280474485424 8.523053574262882
result:
ok 11 numbers
Test #38:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
6834 19 711
output:
111261.799946590525721 3.281856944611225 6.563764624524693 9.845773775826979 13.127935136173338 16.410299445572077 19.692917447168956 22.975839888031646 26.259117519934246 29.542801100141868 32.826941392195314
result:
ok 11 numbers
Test #39:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
9808 44 779
output:
368851.258658519989154 0.882797324562552 1.765630183132059 2.648534111145781 3.531544646901631 4.414697332988659 5.298027717717691 6.181571356552210 7.065363813539518 7.949440662742244 8.833837489670264
result:
ok 11 numbers