QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#578927 | #8027. Sky Garden | slcx | AC ✓ | 1ms | 3956kb | C++17 | 1.1kb | 2024-09-20 22:57:42 | 2024-09-20 22:57:42 |
Judging History
answer
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<char> vc;
const int inf=0x3f;
const int N=1e3+10;
const db eps=1e-9;
const db PI=acos(-1.0);
ll n,m;
db hc[N];
db su[N];//第i个圆到该圆内部所有其他的的最短路和
ll a2(ll l,ll r) {
return (l+r)*(r-l+1)/2;
}
int main() {
cin>>n>>m;
for(int i=1;i<=n;i++) {
ll r=i;
hc[i]=2*r*PI/(2.0*m);
}
db c1=0,c2=0;
ll sm=0;
for(int i=1;i<=n;i++) {
int l=0,r=m-1;
while(l<r) {
int mid=(l+r+1)>>1;
if(hc[i]*mid<=2.0*i) l=mid;
else r=mid-1;
}
su[i]+=hc[i]*a2(0,l)*2+(2*m-1-l*2)*2*i;
c1+=m*su[i];
}
for(int i=n;i>=1;i--) {
for(int j=i-1;j>=1;j--) {
db sum=2.0*m*((i-j)*2*m+su[j]);
c2+=sum;
}
}
double c3=2*m*a2(1,n);
if(m==1) c3=0;
printf("%.12lf",c1+c2+c3);
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3832kb
input:
1 2
output:
14.283185307180
result:
ok found '14.2831853', expected '14.2831853', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
1 1
output:
2.000000000000
result:
ok found '2.0000000', expected '2.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
500 1
output:
166916500.000000000000
result:
ok found '166916500.0000000', expected '166916500.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
500 2
output:
763585309.561365246773
result:
ok found '763585309.5613652', expected '763585309.5613225', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
500 499
output:
49125277129816.859375000000
result:
ok found '49125277129816.8593750', expected '49125277129819.2734375', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
500 500
output:
49322369986248.960937500000
result:
ok found '49322369986248.9609375', expected '49322369986259.6953125', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
252 139
output:
488838606007.194274902344
result:
ok found '488838606007.1942749', expected '488838606007.1795654', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
96 359
output:
181277190205.038787841797
result:
ok found '181277190205.0387878', expected '181277190205.0371094', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
237 487
output:
4992630041184.350585937500
result:
ok found '4992630041184.3505859', expected '4992630041184.1953125', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
81 411
output:
142953582310.276519775391
result:
ok found '142953582310.2765198', expected '142953582310.2773743', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
221 39
output:
25968641931.522518157959
result:
ok found '25968641931.5225182', expected '25968641931.5297089', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
270 259
output:
2087014641699.974365234375
result:
ok found '2087014641699.9743652', expected '2087014641700.0227051', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
422 387
output:
17770193032349.394531250000
result:
ok found '17770193032349.3945312', expected '17770193032349.6250000', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
63 15
output:
89852047.508517712355
result:
ok found '89852047.5085177', expected '89852047.5085171', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
407 439
output:
20515296102929.812500000000
result:
ok found '20515296102929.8125000', expected '20515296102923.2070312', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
18 18
output:
3123573.695647558197
result:
ok found '3123573.6956476', expected '3123573.6956476', error '0.0000000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
171 146
output:
168786179167.021636962891
result:
ok found '168786179167.0216370', expected '168786179167.0194092', error '0.0000000'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
311 70
output:
232875509505.283630371094
result:
ok found '232875509505.2836304', expected '232875509505.2748413', error '0.0000000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
155 494
output:
1439825967582.980468750000
result:
ok found '1439825967582.9804688', expected '1439825967582.9992676', error '0.0000000'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
204 418
output:
2347066265474.425292968750
result:
ok found '2347066265474.4252930', expected '2347066265474.4873047', error '0.0000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
344 46
output:
136054690372.268463134766
result:
ok found '136054690372.2684631', expected '136054690372.2714844', error '0.0000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
188 174
output:
318429902145.044799804688
result:
ok found '318429902145.0447998', expected '318429902145.0420532', error '0.0000000'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
137 394
output:
632896487876.029296875000
result:
ok found '632896487876.0292969', expected '632896487876.0313721', error '0.0000000'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
481 22
output:
85020954588.196563720703
result:
ok found '85020954588.1965637', expected '85020954588.2031097', error '0.0000000'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
30 446
output:
8705279441.352088928223
result:
ok found '8705279441.3520889', expected '8705279441.3520851', error '0.0000000'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
204 440
output:
2600626525627.992675781250
result:
ok found '2600626525627.9926758', expected '2600626525627.9575195', error '0.0000000'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
2 3
output:
175.415926535898
result:
ok found '175.4159265', expected '175.4159265', error '0.0000000'
Extra Test:
score: 0
Extra Test Passed