QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#77502#4005. FrogchenshiWA 23ms1844kbC++1.0kb2023-02-14 22:02:142023-02-14 22:02:18

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-14 22:02:18]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:1844kb
  • [2023-02-14 22:02:14]
  • 提交

answer

#include<cstdio>
#include<cmath>
using namespace std;
const long double PI=acosl(-1);
int T,ds,dt,ans;long double X[9],Y[9],Alpha;bool flg;
inline void slv(){
	long double d=sqrtl((X[1]-X[3])*(X[1]-X[3])+(Y[1]-Y[3])*(Y[1]-Y[3]))/2,k=sqrtl(1-d*d)/d;
	X[2]=(X[1]+X[3])/2+(Y[3]-Y[1])/2*k;Y[2]=(Y[1]+Y[3])/2+(X[1]-X[3])/2*k;
}
int main(){
	for(scanf("%d",&T);T--;flg=0){
		scanf("%d%d",&ds,&dt);
		if(ds==dt){printf("0\n1 0\n");continue;}
		dt=(dt+360-ds)%360;
		if(dt>180) dt=360-dt,flg=1;
		Alpha=dt*PI/180;
		if(dt<=90) ans=2,X[0]=1,Y[0]=0,X[2]=cosl(Alpha),Y[2]=sinl(Alpha),X[1]=X[2]+1,Y[1]=Y[2];
		else if(dt<=131) ans=3,X[0]=1,Y[0]=0,X[1]=1,Y[1]=1,X[3]=cosl(Alpha),Y[3]=sinl(Alpha),slv();
		else ans=4,X[0]=1,Y[0]=0,X[1]=1,Y[1]=1,X[4]=cosl(Alpha),Y[4]=sinl(Alpha),X[3]=X[4]+Y[4],Y[3]=Y[4]-X[4],slv();
		if(flg) for(int i=0;i<=ans;++i) Y[i]*=-1;
		printf("%d\n",ans);
		for(int i=0;i<=ans;++i)
			Alpha=ds*PI/180,printf("%.9Lf %.9Lf\n",X[i]*cosl(Alpha)-Y[i]*sinl(Alpha),X[i]*sinl(Alpha)+Y[i]*cosl(Alpha));
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 1732kb

input:

3
0 0
0 90
180 0

output:

0
1 0
2
1.000000000 0.000000000
1.000000000 1.000000000
-0.000000000 1.000000000
4
-1.000000000 -0.000000000
-1.000000000 -1.000000000
0.000000000 -1.000000000
1.000000000 -1.000000000
1.000000000 0.000000000

result:

ok ok

Test #2:

score: -100
Wrong Answer
time: 23ms
memory: 1844kb

input:

10000
194 96
89 164
139 41
323 35
185 221
0 275
53 116
233 79
209 91
236 12
94 291
332 293
207 31
133 329
60 114
1 91
273 103
69 193
220 303
100 118
42 15
331 201
26 103
347 292
184 148
307 197
84 326
52 224
257 27
3 99
310 26
138 288
112 17
206 159
302 104
58 121
276 268
236 134
281 173
147 128
72 ...

output:

3
-0.970295726 -0.241921896
-1.212217622 0.728373831
-0.850392697 1.660619895
-0.104528463 0.994521895
2
0.017452406 0.999847695
-0.943809290 1.275485051
-0.961261696 0.275637356
3
-0.754709580 0.656059029
-0.098650551 1.410768609
0.872534969 1.649093358
0.754709580 0.656059029
2
0.798635510 -0.6018...

result:

wrong answer Starting point too far from actual. (Test case 1785)