QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404726#4005. FrogXUAN_WA 1ms4052kbC++142.0kb2024-05-04 15:48:412024-05-04 15:48:42

Judging History

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

  • [2024-05-04 15:48:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4052kb
  • [2024-05-04 15:48:41]
  • 提交

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 db &a) const
    {
    	Node res;
    	res.x=x*a;
    	res.y=y*a;
    	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;
db dis(Node a,Node b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
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*(sqrt(1.0-dis(s,mid)*dis(s,mid))/dis(o,mid));
	}else if(dag<=131){
		Node tt;
		tt.rd(ds+90.0);
		ans[++tot]=s+tt;
		s=ans[tot];
		Node mid=s+t;
		ans[++tot]=mid*(sqrt(1.0-dis(s,mid)*dis(s,mid))/dis(o,mid));
	}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*(sqrt(1.0-dis(s,mid)*dis(s,mid))/dis(o,mid));
	}
	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;
}
/*



*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4052kb

input:

3
0 0
0 90
180 0

output:

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

result:

wrong answer Jump #1 went inside pillar. (Test case 2)