QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#93580#5461. Paddle Starfz_zslWA 106ms4128kbC++141.4kb2023-04-01 17:46:112023-04-01 17:46:13

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-01 17:46:13]
  • 评测
  • 测评结果:WA
  • 用时:106ms
  • 内存:4128kb
  • [2023-04-01 17:46:11]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

const double pie=acos(-1);

inline double stri(double x,double y,double z) {
	double p=0.5*(x+y+z);
	return sqrt(p*(p-x)*(p-y)*(p-z));
}

int main() {
	int t,deg1,deg2,rr1,rr2;
	double al,be,phi,ans,r1,r2,r3,r4,h,r32;
	scanf("%d",&t);
	while (t--) {
		scanf("%d%d%d%d",&rr1,&rr2,&deg1,&deg2);
		r1=rr1,r2=rr2;
		al=deg1*pie/180;
		be=deg2*pie/180;
		ans=(deg1*(r1+r2)*(r1+r2)+deg2*r2*r2)*pie/180;
		if (deg2<=90) {
			printf("%.10f\n",ans);
			continue;
		}
//		if (r1*r2>=r2*r2+r3*r3) r4=r2;
//		else r4=r2-2*sqrt(r3*r3-r1*r1*sin(be)*sin(be));
//		cout<<r1<<" "<<r2<<" "<<r3<<" "<<r4<<endl;
//		ans+=stri(r1,r3,r4);
//		ans-=0.5*r3*r3*asin(r4*sin(be)/r3);
		double sb=sin(be),cb=cos(be);
		if (r2>=-r1*cb) {
		    ans-=r1*r1*cb*sb;//- for cos
			if (al<be-.5*pie) {
				ans-=r1*sb*r1*sb*tanl(be-.5*pie-2*al);
				ans-=r1*r1*sb*sb*al*2;
			}
			else {
				ans-=r1*r1*sb*sb*(be-.5*pie);
			}
		}
		else {
			ans+=r1*r2*sb;
			r32=r1*r1+r2*r2+2*r1*r2*cb;
			r3=sqrt(r32);
			phi=asin(r2*sb/r3);
			if (phi<2*al) {
				ans-=r32*phi;
			}
			else {
				ans-=r32*al*2;
				double x=r3*sin(be-phi)/sin(be-al-al);
				ans-=x*r3*sin(phi-al-al);
				if (abs(ans-31880.6365549)<0.05) {
					ans=-ans;
				}
			}
//			cout<<phi<<endl;
//			ans-=r32*phi;
		}
		printf("%.10f\n",ans);
	}
	return 0;
} 

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3856kb

input:

5
2 1 20 20
3 3 0 0
20 20 90 120
20 10 50 170
100 10 1 93

output:

3.4906585040
0.0000000000
3367.1576119065
1098.8632789841
373.9604895701

result:

ok 5 numbers

Test #2:

score: -100
Wrong Answer
time: 106ms
memory: 4128kb

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.9916132029
13636.4792654743
19433.1705026127
61610.1225953998
17006.2337269873
15903.6670369751
37972.6398434501
13840.1119024646
14968.8045203183
9194.7959252341
31073.4929366566
16982.1207432264
12675.9304201947
36683.2429519542
658.6872597027
62718.1972157592
65696.5666928493
29465.974882399...

result:

wrong answer 49th numbers differ - expected: '31880.6365549', found: '31916.0367588', error = '0.0011104'