QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#295219 | #5461. Paddle Star | ushg8877 | WA | 120ms | 4024kb | C++14 | 903b | 2023-12-30 21:03:46 | 2023-12-30 21:03:46 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
mt19937 rnd(time(0));
const long double pi=acos(-1);
long double solve(){
long double x,y,a,b;cin>>x>>y>>a>>b;
a=a/180*pi,b=b/180*pi;
long double ans=y*y*b+(x+y)*(x+y)*a;
if(b>pi/2){
long double r=sqrt(x*x+y*y-2*cos(pi-b)*x*y);
long double c=acos((r*r+x*x-y*y)/(2*r*x));
// cerr<<r<<' '<<c<<endl;
if(r*r+y*y<x*x) ans+=2*(0.5*sin(pi-b)*x*y-c/(2*pi)*r*r*pi);
else{
long double h=sin(pi-b)*x;
ans+=2*(0.5*sin(pi-b)*cos(pi-b)*x*x-(b-pi/2)/(2*pi)*h*h*pi);
if(b-pi/2>2*a){
auto f=[&](long double r,long double a){
// cout<<r<<' '<<a<<endl;
return 0.5*r*r*tan(a)-a/(2*pi)*r*r*pi;
};
ans-=2*f(h,b-pi/2-2*a);
}
}
}
return ans;
}
int main(){
ios::sync_with_stdio(false);
int _;cin>>_;
while(_--) cout<<setprecision(12)<<solve()<<endl;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 4024kb
input:
5 2 1 20 20 3 3 0 0 20 20 90 120 20 10 50 170 100 10 1 93
output:
3.49065850399 0 3367.15761191 1098.86327898 373.96048957
result:
ok 5 numbers
Test #2:
score: -100
Wrong Answer
time: 120ms
memory: 3788kb
input:
100000 88 12 24 116 79 15 84 150 96 52 31 141 100 100 81 29 83 29 71 99 95 92 5 87 99 97 39 72 79 72 20 65 67 39 60 116 100 89 1 62 78 77 63 45 62 34 83 178 92 49 24 103 94 73 66 49 20 14 24 51 100 97 66 109 94 94 86 82 82 79 49 67 76 38 88 118 92 79 58 112 93 23 40 167 87 34 13 25 96 18 73 15 94 38...
output:
4526.9916132 13636.4792655 19433.1705026 61610.1225954 17006.233727 15903.667037 37972.6398435 13840.1119025 14968.8045203 9194.79592523 31073.4929367 16982.1207432 12675.9304202 36683.242952 658.687259703 62718.1972158 65696.5666928 29465.9748824 23128.0289502 41946.0282993 11050.5789317 3826.33767...
result:
wrong answer 31st numbers differ - expected: '12961.4718368', found: '12990.7975159', error = '0.0022625'