QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#404723#4005. FrogXUAN_WA 13ms4016kbC++141.6kb2024-05-04 15:29:352024-05-04 15:29:37

Judging History

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

  • [2024-05-04 15:29:37]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:4016kb
  • [2024-05-04 15:29:35]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define db double
using namespace std;
const int N = 1e5+7;
const db Pi = acos(-1.0),di=180.00;
template <typename T> inline void read(T &x){
	T ch=getchar(),xx=1;x=0;
	while(!isdigit(ch)) xx=ch=='-'?-1:xx,ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	x*=xx;
}
template <typename T> void print(T x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) print(x/10);
	putchar(x%10+'0');
}
struct Node{
	db x,y;
	void rd(int  a){
		a=(a+360)%360;
		x=cos(Pi*(db)a/di);
		y=sin(Pi*(db)a/di);
	} 
	Node operator + (const Node &a) const
    {
    	Node res;
    	res.x=x+a.x;
    	res.y=y+a.y;
    	return res;
    }
    Node operator - (const Node &a) const
    {
    	Node res;
    	res.x=x-a.x;
    	res.y=y-a.y;
    	return res;
    }
    void pr(){
    	printf("%.10lf %.10lf\n",x,y);
    }
}ans[10],s,t,o;
int tot;
int ds,dt;
void solve(int dag){
	tot=0;
	ans[++tot]=s;
	if(dag==0) return;
	if(dag<=90){
		Node mid=s+t;
		ans[++tot]=mid-o;
	}else if(dag<=131){
		Node tt;
		tt.rd(ds+90.0);
		ans[++tot]=s+tt;
		tt.rd(dt-90.0);
		ans[++tot]=t+tt;
	}else{
		Node tt;
		tt.rd(ds+90.0);
		Node mid=s+tt;
		ans[++tot]=mid-o;
		s=tt;
		ans[++tot]=s;
		mid=s+t;
		ans[++tot]=mid-o;
	}
	ans[++tot]=t;	
}
int main(){
	int T;
	read(T);
	o.x=o.y=0.0;
	while(T--){
		bool flag=1;
		read(ds),read(dt);
		if(dt-ds<=180 && dt-ds>=0) flag=0;
		else swap(ds,dt);
		s.rd(db(ds)),t.rd(db(dt));
		solve(dt-ds);
		print(tot-1),putchar('\n');
		if(!flag) for(int i=1;i<=tot;++i) ans[i].pr();
		else for(int i=tot;i;--i) ans[i].pr();
	}
	return 0;
}
/*



*/

詳細信息

Test #1:

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

input:

3
0 0
0 90
180 0

output:

0
1.0000000000 0.0000000000
2
1.0000000000 0.0000000000
1.0000000000 1.0000000000
0.0000000000 1.0000000000
4
-1.0000000000 0.0000000000
-1.0000000000 1.0000000000
0.0000000000 1.0000000000
1.0000000000 1.0000000000
1.0000000000 0.0000000000

result:

ok ok

Test #2:

score: -100
Wrong Answer
time: 13ms
memory: 4016kb

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.9702957263 -0.2419218956
-1.2122176219 0.7283738307
-1.0990503586 0.8899934321
-0.1045284633 0.9945218954
2
0.0174524064 0.9998476952
-0.9438092895 1.2754850510
-0.9612616959 0.2756373558
3
-0.7547095802 0.6560590290
-0.0986505512 1.4107686092
0.0986505512 1.4107686092
0.7547095802 0.6560590290...

result:

wrong answer Jump #2 length too far from 1.000000 (Test case 1)