QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#71530 | #3233. Everything Has Changed | chenshi# | AC ✓ | 11ms | 1620kb | C++ | 427b | 2023-01-11 08:36:13 | 2023-01-11 08:36:16 |
Judging History
answer
#include<cstdio>
#include<cmath>
using namespace std;
const long double PI=acosl(-1),eps=1e-9;
int T,m;long double R,x,y,r,d,ans;
int main(){
for(scanf("%d",&T);T--;printf("%.7Lf\n",ans)){
scanf("%d%Lf",&m,&R);ans=2*PI*R;
for(;m--;){
scanf("%Lf%Lf%Lf",&x,&y,&r);d=sqrtl(x*x+y*y);
if(r+R>d&&d+r+eps>R)
ans-=acosl((R*R+d*d-r*r)/(2*d*R))*2*R,ans+=acosl((r*r+d*d-R*R)/(2*d*r))*2*r;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 1620kb
input:
1000 55 551 85 920 149 443 -899 185 20 597 32 900 59 191 -545 424 7 -878 -69 63 -143 -844 282 -390 961 275 839 -549 227 -582 -147 27 -439 550 99 -70 706 69 224 -937 20 -968 609 125 141 700 5 527 -290 15 -171 640 4 -613 -301 65 679 -175 14 314 -486 3 -287 528 17 -553 -108 3 -202 521 2 573 -301 24 905...
output:
5793.0285378 730.8956046 106.8141502 5607.3394169 4817.0445137 7132.2657518 97.3237412 2579.5598792 2831.6319845 4828.8504562 2690.1493898 8643.5476552 5747.5882246 2696.4366405 3448.4811646 11698.9346816 7915.2492475 3240.6841809 8416.1669763 2158.3497968 6134.0632607 7031.6582300 2409.4250551 1062...
result:
ok 1000 numbers