QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#358447 | #6829. It Takes Two of Two | crsfaa | AC ✓ | 11ms | 14948kb | C++14 | 1.3kb | 2024-03-19 19:55:28 | 2024-03-19 19:55:31 |
Judging History
answer
#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
using Yukinoshita Yukino;
int read()
{
int s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9') w=ch=='-'?-1:1,ch=getchar();
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
double dp[205][205][205];//有x条非平凡链,y个孤点,z个二元链
/*
非平凡链合并:4x^2-2x,x-=1
非平凡链加孤点:4xy,y-=1
非平凡链加二元链:8xz,z-=1
孤点加孤点:y^2-y, y-=2,z+=1
孤点加二元链:4yz,x+=1,y-=1,z-=1
二元链合并:4z^2-4z,x+=1,z-=2
*/
int main()
{
int n=read(),x,y,z,sum;
double ans=0;
for(sum=0;sum<=n;sum++)
for(x=0;x<=sum;x++)
for(y=0;x+y<=sum;y++)
{
z=sum-x-y;
if(x*3+y+z*2>n) continue;
double fm=4*x*x-2*x+4*x*y+8*x*z+(y-1)*y+4*y*z+4*z*z-4*z,v=n*n/fm,tp;
if(!fm) continue;
if(x)
dp[x][y][z]+=dp[x-1][y][z]*(4*x*x-2*x)/fm;
if(y)
dp[x][y][z]+=dp[x][y-1][z]*4*x*y/fm;
if(z)
dp[x][y][z]+=dp[x][y][z-1]*8*x*z/fm;
if(y>=2)
dp[x][y][z]+=dp[x][y-2][z+1]*(y-1)*y/fm;
if(y&&z)
dp[x][y][z]+=dp[x+1][y-1][z-1]*4*y*z/fm;
if(z>=2)
dp[x][y][z]+=dp[x+1][y][z-2]*(4*z*z-4*z)/fm;
dp[x][y][z]+=v;
// cout<<x<<' '<<y<<' '<<z<<':'<<fm<<' '<<dp[x][y][z]<<endl;
}
printf("%.8lf",dp[0][n][0]);
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3960kb
input:
1
output:
0.00000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
2
output:
2.00000000
result:
ok found '2.0000000', expected '2.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
3
output:
8.25000000
result:
ok found '8.2500000', expected '8.2500000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
4
output:
11.33333333
result:
ok found '11.3333333', expected '11.3333333', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
5
output:
17.04861111
result:
ok found '17.0486111', expected '17.0486111', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
6
output:
26.03406593
result:
ok found '26.0340659', expected '26.0340659', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
7
output:
35.49756260
result:
ok found '35.4975626', expected '35.4975626', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
8
output:
46.22930531
result:
ok found '46.2293053', expected '46.2293053', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
9
output:
58.61439635
result:
ok found '58.6143963', expected '58.6143964', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
10
output:
72.43776842
result:
ok found '72.4377684', expected '72.4377684', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
11
output:
87.67879666
result:
ok found '87.6787967', expected '87.6787967', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
12
output:
104.36131898
result:
ok found '104.3613190', expected '104.3613190', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
13
output:
122.48185932
result:
ok found '122.4818593', expected '122.4818593', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
14
output:
142.03652436
result:
ok found '142.0365244', expected '142.0365244', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
15
output:
163.02399178
result:
ok found '163.0239918', expected '163.0239918', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
16
output:
185.44294196
result:
ok found '185.4429420', expected '185.4429420', error '0.0000000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 4004kb
input:
17
output:
209.29206457
result:
ok found '209.2920646', expected '209.2920646', error '0.0000000'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
18
output:
234.57019534
result:
ok found '234.5701953', expected '234.5701953', error '0.0000000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
19
output:
261.27628211
result:
ok found '261.2762821', expected '261.2762821', error '0.0000000'
Test #20:
score: 0
Accepted
time: 0ms
memory: 4096kb
input:
20
output:
289.40936221
result:
ok found '289.4093622', expected '289.4093622', error '0.0000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3996kb
input:
21
output:
318.96855141
result:
ok found '318.9685514', expected '318.9685514', error '0.0000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 4104kb
input:
22
output:
349.95303412
result:
ok found '349.9530341', expected '349.9530341', error '0.0000000'
Test #23:
score: 0
Accepted
time: 0ms
memory: 4120kb
input:
23
output:
382.36205492
result:
ok found '382.3620549', expected '382.3620549', error '0.0000000'
Test #24:
score: 0
Accepted
time: 0ms
memory: 4096kb
input:
24
output:
416.19491154
result:
ok found '416.1949115', expected '416.1949115', error '0.0000000'
Test #25:
score: 0
Accepted
time: 0ms
memory: 4060kb
input:
25
output:
451.45094892
result:
ok found '451.4509489', expected '451.4509489', error '0.0000000'
Test #26:
score: 0
Accepted
time: 0ms
memory: 4064kb
input:
26
output:
488.12955416
result:
ok found '488.1295542', expected '488.1295542', error '0.0000000'
Test #27:
score: 0
Accepted
time: 0ms
memory: 4088kb
input:
27
output:
526.23015219
result:
ok found '526.2301522', expected '526.2301522', error '0.0000000'
Test #28:
score: 0
Accepted
time: 0ms
memory: 4148kb
input:
28
output:
565.75220204
result:
ok found '565.7522020', expected '565.7522020', error '0.0000000'
Test #29:
score: 0
Accepted
time: 1ms
memory: 4132kb
input:
29
output:
606.69519356
result:
ok found '606.6951936', expected '606.6951936', error '0.0000000'
Test #30:
score: 0
Accepted
time: 1ms
memory: 4192kb
input:
30
output:
649.05864468
result:
ok found '649.0586447', expected '649.0586447', error '0.0000000'
Test #31:
score: 0
Accepted
time: 1ms
memory: 4220kb
input:
31
output:
692.84209882
result:
ok found '692.8420988', expected '692.8420988', error '0.0000000'
Test #32:
score: 0
Accepted
time: 0ms
memory: 4292kb
input:
32
output:
738.04512282
result:
ok found '738.0451228', expected '738.0451228', error '0.0000000'
Test #33:
score: 0
Accepted
time: 1ms
memory: 4260kb
input:
33
output:
784.66730490
result:
ok found '784.6673049', expected '784.6673049', error '0.0000000'
Test #34:
score: 0
Accepted
time: 0ms
memory: 4276kb
input:
34
output:
832.70825303
result:
ok found '832.7082530', expected '832.7082530', error '0.0000000'
Test #35:
score: 0
Accepted
time: 1ms
memory: 4284kb
input:
35
output:
882.16759336
result:
ok found '882.1675934', expected '882.1675934', error '0.0000000'
Test #36:
score: 0
Accepted
time: 1ms
memory: 4324kb
input:
36
output:
933.04496885
result:
ok found '933.0449689', expected '933.0449689', error '0.0000000'
Test #37:
score: 0
Accepted
time: 1ms
memory: 4208kb
input:
37
output:
985.34003806
result:
ok found '985.3400381', expected '985.3400381', error '0.0000000'
Test #38:
score: 0
Accepted
time: 1ms
memory: 4428kb
input:
38
output:
1039.05247402
result:
ok found '1039.0524740', expected '1039.0524740', error '0.0000000'
Test #39:
score: 0
Accepted
time: 1ms
memory: 4384kb
input:
39
output:
1094.18196325
result:
ok found '1094.1819633', expected '1094.1819632', error '0.0000000'
Test #40:
score: 0
Accepted
time: 1ms
memory: 4400kb
input:
40
output:
1150.72820482
result:
ok found '1150.7282048', expected '1150.7282048', error '0.0000000'
Test #41:
score: 0
Accepted
time: 1ms
memory: 4376kb
input:
41
output:
1208.69090958
result:
ok found '1208.6909096', expected '1208.6909096', error '0.0000000'
Test #42:
score: 0
Accepted
time: 0ms
memory: 4400kb
input:
42
output:
1268.06979936
result:
ok found '1268.0697994', expected '1268.0697994', error '0.0000000'
Test #43:
score: 0
Accepted
time: 1ms
memory: 4404kb
input:
43
output:
1328.86460631
result:
ok found '1328.8646063', expected '1328.8646063', error '0.0000000'
Test #44:
score: 0
Accepted
time: 1ms
memory: 4500kb
input:
44
output:
1391.07507226
result:
ok found '1391.0750723', expected '1391.0750723', error '0.0000000'
Test #45:
score: 0
Accepted
time: 0ms
memory: 4476kb
input:
45
output:
1454.70094817
result:
ok found '1454.7009482', expected '1454.7009482', error '0.0000000'
Test #46:
score: 0
Accepted
time: 0ms
memory: 4612kb
input:
46
output:
1519.74199356
result:
ok found '1519.7419936', expected '1519.7419936', error '0.0000000'
Test #47:
score: 0
Accepted
time: 0ms
memory: 4572kb
input:
47
output:
1586.19797607
result:
ok found '1586.1979761', expected '1586.1979761', error '0.0000000'
Test #48:
score: 0
Accepted
time: 1ms
memory: 4556kb
input:
48
output:
1654.06867098
result:
ok found '1654.0686710', expected '1654.0686710', error '0.0000000'
Test #49:
score: 0
Accepted
time: 1ms
memory: 4568kb
input:
49
output:
1723.35386080
result:
ok found '1723.3538608', expected '1723.3538608', error '0.0000000'
Test #50:
score: 0
Accepted
time: 0ms
memory: 4604kb
input:
50
output:
1794.05333491
result:
ok found '1794.0533349', expected '1794.0533349', error '0.0000000'
Test #51:
score: 0
Accepted
time: 1ms
memory: 4556kb
input:
51
output:
1866.16688916
result:
ok found '1866.1668892', expected '1866.1668892', error '0.0000000'
Test #52:
score: 0
Accepted
time: 0ms
memory: 4668kb
input:
52
output:
1939.69432558
result:
ok found '1939.6943256', expected '1939.6943256', error '0.0000000'
Test #53:
score: 0
Accepted
time: 3ms
memory: 10412kb
input:
153
output:
16628.00267053
result:
ok found '16628.0026705', expected '16628.0026705', error '0.0000000'
Test #54:
score: 0
Accepted
time: 6ms
memory: 10612kb
input:
154
output:
16845.20045860
result:
ok found '16845.2004586', expected '16845.2004586', error '0.0000000'
Test #55:
score: 0
Accepted
time: 0ms
memory: 10564kb
input:
155
output:
17063.80370767
result:
ok found '17063.8037077', expected '17063.8037077', error '0.0000000'
Test #56:
score: 0
Accepted
time: 0ms
memory: 10712kb
input:
156
output:
17283.81238040
result:
ok found '17283.8123804', expected '17283.8123804', error '0.0000000'
Test #57:
score: 0
Accepted
time: 6ms
memory: 10752kb
input:
157
output:
17505.22643977
result:
ok found '17505.2264398', expected '17505.2264398', error '0.0000000'
Test #58:
score: 0
Accepted
time: 0ms
memory: 10824kb
input:
158
output:
17728.04584913
result:
ok found '17728.0458491', expected '17728.0458491', error '0.0000000'
Test #59:
score: 0
Accepted
time: 3ms
memory: 11036kb
input:
159
output:
17952.27057215
result:
ok found '17952.2705721', expected '17952.2705722', error '0.0000000'
Test #60:
score: 0
Accepted
time: 3ms
memory: 11004kb
input:
160
output:
18177.90057284
result:
ok found '18177.9005728', expected '18177.9005728', error '0.0000000'
Test #61:
score: 0
Accepted
time: 0ms
memory: 11040kb
input:
161
output:
18404.93581552
result:
ok found '18404.9358155', expected '18404.9358155', error '0.0000000'
Test #62:
score: 0
Accepted
time: 6ms
memory: 11240kb
input:
162
output:
18633.37626486
result:
ok found '18633.3762649', expected '18633.3762649', error '0.0000000'
Test #63:
score: 0
Accepted
time: 0ms
memory: 11376kb
input:
163
output:
18863.22188583
result:
ok found '18863.2218858', expected '18863.2218858', error '0.0000000'
Test #64:
score: 0
Accepted
time: 0ms
memory: 11300kb
input:
164
output:
19094.47264370
result:
ok found '19094.4726437', expected '19094.4726437', error '0.0000000'
Test #65:
score: 0
Accepted
time: 3ms
memory: 11392kb
input:
165
output:
19327.12850407
result:
ok found '19327.1285041', expected '19327.1285041', error '0.0000000'
Test #66:
score: 0
Accepted
time: 3ms
memory: 11636kb
input:
166
output:
19561.18943285
result:
ok found '19561.1894328', expected '19561.1894328', error '0.0000000'
Test #67:
score: 0
Accepted
time: 0ms
memory: 11680kb
input:
167
output:
19796.65539621
result:
ok found '19796.6553962', expected '19796.6553962', error '0.0000000'
Test #68:
score: 0
Accepted
time: 3ms
memory: 11712kb
input:
168
output:
20033.52636065
result:
ok found '20033.5263607', expected '20033.5263606', error '0.0000000'
Test #69:
score: 0
Accepted
time: 0ms
memory: 11856kb
input:
169
output:
20271.80229293
result:
ok found '20271.8022929', expected '20271.8022929', error '0.0000000'
Test #70:
score: 0
Accepted
time: 3ms
memory: 12024kb
input:
170
output:
20511.48316014
result:
ok found '20511.4831601', expected '20511.4831601', error '0.0000000'
Test #71:
score: 0
Accepted
time: 7ms
memory: 12056kb
input:
171
output:
20752.56892959
result:
ok found '20752.5689296', expected '20752.5689296', error '0.0000000'
Test #72:
score: 0
Accepted
time: 4ms
memory: 12104kb
input:
172
output:
20995.05956892
result:
ok found '20995.0595689', expected '20995.0595689', error '0.0000000'
Test #73:
score: 0
Accepted
time: 0ms
memory: 12176kb
input:
173
output:
21238.95504602
result:
ok found '21238.9550460', expected '21238.9550460', error '0.0000000'
Test #74:
score: 0
Accepted
time: 0ms
memory: 12408kb
input:
174
output:
21484.25532904
result:
ok found '21484.2553290', expected '21484.2553290', error '0.0000000'
Test #75:
score: 0
Accepted
time: 4ms
memory: 12384kb
input:
175
output:
21730.96038641
result:
ok found '21730.9603864', expected '21730.9603864', error '0.0000000'
Test #76:
score: 0
Accepted
time: 0ms
memory: 12540kb
input:
176
output:
21979.07018681
result:
ok found '21979.0701868', expected '21979.0701868', error '0.0000000'
Test #77:
score: 0
Accepted
time: 8ms
memory: 12620kb
input:
177
output:
22228.58469920
result:
ok found '22228.5846992', expected '22228.5846992', error '0.0000000'
Test #78:
score: 0
Accepted
time: 0ms
memory: 12676kb
input:
178
output:
22479.50389277
result:
ok found '22479.5038928', expected '22479.5038928', error '0.0000000'
Test #79:
score: 0
Accepted
time: 4ms
memory: 12828kb
input:
179
output:
22731.82773697
result:
ok found '22731.8277370', expected '22731.8277370', error '0.0000000'
Test #80:
score: 0
Accepted
time: 0ms
memory: 12948kb
input:
180
output:
22985.55620149
result:
ok found '22985.5562015', expected '22985.5562015', error '0.0000000'
Test #81:
score: 0
Accepted
time: 4ms
memory: 13092kb
input:
181
output:
23240.68925627
result:
ok found '23240.6892563', expected '23240.6892563', error '0.0000000'
Test #82:
score: 0
Accepted
time: 3ms
memory: 13016kb
input:
182
output:
23497.22687150
result:
ok found '23497.2268715', expected '23497.2268715', error '0.0000000'
Test #83:
score: 0
Accepted
time: 3ms
memory: 13268kb
input:
183
output:
23755.16901758
result:
ok found '23755.1690176', expected '23755.1690176', error '0.0000000'
Test #84:
score: 0
Accepted
time: 0ms
memory: 13380kb
input:
184
output:
24014.51566517
result:
ok found '24014.5156652', expected '24014.5156652', error '0.0000000'
Test #85:
score: 0
Accepted
time: 3ms
memory: 13352kb
input:
185
output:
24275.26678514
result:
ok found '24275.2667851', expected '24275.2667851', error '0.0000000'
Test #86:
score: 0
Accepted
time: 3ms
memory: 13532kb
input:
186
output:
24537.42234861
result:
ok found '24537.4223486', expected '24537.4223486', error '0.0000000'
Test #87:
score: 0
Accepted
time: 3ms
memory: 13564kb
input:
187
output:
24800.98232691
result:
ok found '24800.9823269', expected '24800.9823269', error '0.0000000'
Test #88:
score: 0
Accepted
time: 9ms
memory: 13672kb
input:
188
output:
25065.94669159
result:
ok found '25065.9466916', expected '25065.9466916', error '0.0000000'
Test #89:
score: 0
Accepted
time: 6ms
memory: 13892kb
input:
189
output:
25332.31541441
result:
ok found '25332.3154144', expected '25332.3154144', error '0.0000000'
Test #90:
score: 0
Accepted
time: 0ms
memory: 13872kb
input:
190
output:
25600.08846737
result:
ok found '25600.0884674', expected '25600.0884674', error '0.0000000'
Test #91:
score: 0
Accepted
time: 4ms
memory: 14032kb
input:
191
output:
25869.26582267
result:
ok found '25869.2658227', expected '25869.2658227', error '0.0000000'
Test #92:
score: 0
Accepted
time: 0ms
memory: 14084kb
input:
192
output:
26139.84745272
result:
ok found '26139.8474527', expected '26139.8474527', error '0.0000000'
Test #93:
score: 0
Accepted
time: 5ms
memory: 14176kb
input:
193
output:
26411.83333013
result:
ok found '26411.8333301', expected '26411.8333301', error '0.0000000'
Test #94:
score: 0
Accepted
time: 11ms
memory: 14344kb
input:
194
output:
26685.22342772
result:
ok found '26685.2234277', expected '26685.2234277', error '0.0000000'
Test #95:
score: 0
Accepted
time: 8ms
memory: 14460kb
input:
195
output:
26960.01771852
result:
ok found '26960.0177185', expected '26960.0177185', error '0.0000000'
Test #96:
score: 0
Accepted
time: 7ms
memory: 14436kb
input:
196
output:
27236.21617575
result:
ok found '27236.2161757', expected '27236.2161758', error '0.0000000'
Test #97:
score: 0
Accepted
time: 7ms
memory: 14732kb
input:
197
output:
27513.81877284
result:
ok found '27513.8187728', expected '27513.8187728', error '0.0000000'
Test #98:
score: 0
Accepted
time: 5ms
memory: 14840kb
input:
198
output:
27792.82548338
result:
ok found '27792.8254834', expected '27792.8254834', error '0.0000000'
Test #99:
score: 0
Accepted
time: 11ms
memory: 14948kb
input:
199
output:
28073.23628120
result:
ok found '28073.2362812', expected '28073.2362812', error '0.0000000'
Test #100:
score: 0
Accepted
time: 5ms
memory: 14884kb
input:
200
output:
28355.05114028
result:
ok found '28355.0511403', expected '28355.0511403', error '0.0000000'