QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#760010 | #8027. Sky Garden | __A___ | AC ✓ | 0ms | 3968kb | C++14 | 1.5kb | 2024-11-18 14:02:27 | 2024-11-18 14:02:27 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const long double pai=acos(-1);
long double n,m,p,q,sum1;
int down,up;
void init(){
down=2.0*m/pai,up=ceil(2.0*m/pai);
}
long double calc(int x){
return (x+1)*x/2;
}
pair<long double,long double>sum(int l,int r){
if(l>r){
return {0,0};
}
long double A=0,B=0,limit=down;
if(limit<l){
B=2*(r-l+1);
}
if(limit>r){
A=calc(r)-calc(l-1);
}
if(l<=limit&&limit<=r){
A=calc(limit)-calc(l-1),B=(r-limit)*2;
}
return {A,B};
}
pair<long double,long double>sum2(int l,int r){
if(l>r){
return {0,0};
}
long double A=0,B=0,limit=up;
if(limit<l){
A=r-l+1;
}
if(limit>r){
B=calc(r)-calc(l-1);
}
if(l<=limit&&limit<=r){
A=r-limit+1,B=calc(limit-1)-calc(l-1);
}
return {A,B};
}
signed main(){
cin>>n>>m,init();
if(m==1){
int ans=0;
for(int i=1;i<=2*n;i++){
ans+=i*(2*n-i+1);
if(i<=n){
ans-=2*i;
}
}
cout<<ans;
return 0;
}
for(int i=1;i<=n;i++){
sum1=(sum1+i*(n-i)),q=(q+4*m*calc(n-i)*m);
}
for(int i=1;i<=2*m;i++){
q=(q+2*(sum2(i,-(i+m+1-i-2*m)).first+sum2(1,min(2*m,i+m)-i).first)*calc(n)),p=(p+(sum2(i,-(i+m+1-i-2*m)).second+sum2(1,min(2*m,i+m)-i).second)*calc(n)),p=(p+(sum(2*m+1-i,m-1).first+2*sum(1,min(i+m,2*m)-i).first+sum(i,m-1).first)*sum1),q=(q+(sum(2*m+1-i,m-1).second+2*sum(1,min(i+m,2*m)-i).second+sum(i,m-1).second)*sum1);
}
for(int i=1;i<=n;i++){
q=(q+2*m*i);
}
p/=m;
cout<<setprecision(100)<<p*pai+q;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3708kb
input:
1 2
output:
14.28318530717958623199592693708837032318115234375
result:
ok found '14.2831853', expected '14.2831853', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
1 1
output:
2
result:
ok found '2.0000000', expected '2.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
500 1
output:
166916500
result:
ok found '166916500.0000000', expected '166916500.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
500 2
output:
763585309.5613224729313515126705169677734375
result:
ok found '763585309.5613225', expected '763585309.5613225', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
500 499
output:
49125277129819.33660125732421875
result:
ok found '49125277129819.3359375', expected '49125277129819.2734375', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
500 500
output:
49322369986259.83715057373046875
result:
ok found '49322369986259.8359375', expected '49322369986259.6953125', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
252 139
output:
488838606007.179462432861328125
result:
ok found '488838606007.1794434', expected '488838606007.1795654', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
96 359
output:
181277190205.0371206104755401611328125
result:
ok found '181277190205.0371094', expected '181277190205.0371094', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
237 487
output:
4992630041184.19605731964111328125
result:
ok found '4992630041184.1962891', expected '4992630041184.1953125', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
81 411
output:
142953582310.27736167609691619873046875
result:
ok found '142953582310.2773743', expected '142953582310.2773743', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
221 39
output:
25968641931.5297136418521404266357421875
result:
ok found '25968641931.5297127', expected '25968641931.5297089', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
270 259
output:
2087014641700.02131116390228271484375
result:
ok found '2087014641700.0212402', expected '2087014641700.0227051', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
422 387
output:
17770193032349.6233978271484375
result:
ok found '17770193032349.6250000', expected '17770193032349.6250000', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
63 15
output:
89852047.508517057329299859702587127685546875
result:
ok found '89852047.5085171', expected '89852047.5085171', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
407 439
output:
20515296102923.2057933807373046875
result:
ok found '20515296102923.2070312', expected '20515296102923.2070312', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
18 18
output:
3123573.6956475553261043387465178966522216796875
result:
ok found '3123573.6956476', expected '3123573.6956476', error '0.0000000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
171 146
output:
168786179167.0193158090114593505859375
result:
ok found '168786179167.0193176', expected '168786179167.0194092', error '0.0000000'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
311 70
output:
232875509505.27482879161834716796875
result:
ok found '232875509505.2748413', expected '232875509505.2748413', error '0.0000000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
155 494
output:
1439825967582.99871265888214111328125
result:
ok found '1439825967582.9987793', expected '1439825967582.9992676', error '0.0000000'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
204 418
output:
2347066265474.488292694091796875
result:
ok found '2347066265474.4882812', expected '2347066265474.4873047', error '0.0000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
344 46
output:
136054690372.271501220762729644775390625
result:
ok found '136054690372.2714996', expected '136054690372.2714844', error '0.0000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
188 174
output:
318429902145.042023479938507080078125
result:
ok found '318429902145.0420532', expected '318429902145.0420532', error '0.0000000'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
137 394
output:
632896487876.03144133090972900390625
result:
ok found '632896487876.0314941', expected '632896487876.0313721', error '0.0000000'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
481 22
output:
85020954588.20310211181640625
result:
ok found '85020954588.2030945', expected '85020954588.2031097', error '0.0000000'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
30 446
output:
8705279441.352084748446941375732421875
result:
ok found '8705279441.3520851', expected '8705279441.3520851', error '0.0000000'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
204 440
output:
2600626525627.95667362213134765625
result:
ok found '2600626525627.9565430', expected '2600626525627.9575195', error '0.0000000'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
2 3
output:
175.41592653589793115997963468544185161590576171875
result:
ok found '175.4159265', expected '175.4159265', error '0.0000000'
Extra Test:
score: 0
Extra Test Passed