/*
赛后ZC AC,做两个射线,判断一下偏移角和点在射线的方向即可。
感觉挺水的.....
比赛的时候没写出来....
态度很重要....
*/
#include <cstdio>
#include <iostream>
#include <cmath>
#define pi 3.1415926
using namespace std;
int t,m,s,I;
double A;
int i,j;
struct Point{
double x;
double y;
}P[30],b,a,ta;
double dis(Point a){
return sqrt(a.x*a.x+a.y*a.y);
}
double dmu(Point aa,Point bb){
return aa.x*bb.x+aa.y*bb.y;
}
double xmu(Point aa,Point bb){
return aa.x*bb.y-aa.y*bb.x;
}
int main(){
cin>>t;
int nca;
int o;
while(t--){
scanf("%d%d%d%d%lf",&nca,&m,&s,&I,&A);
for(i=1;i<=m;i++)
scanf("%d%lf%lf",&j,&P[i].x,&P[i].y);
double fd=(A/180.0)*pi;
a.x=cos(fd);
a.y=sin(fd);
b.x=-a.x;
b.y=-a.y;
o=I;
int ans;
printf("%d ",nca);
int f=0;
for(j=1;j<=s;j++){
double M=-360.0;
//printf("oa:%.1lf %.1lf ob:%.1lf %.1lf\n",a.x,a.y,b.x,b.y);
for(i=1;i<=m;i++){
if(i==o || i==I) continue;
ta.x=P[i].x-P[I].x;
ta.y=P[i].y-P[I].y;
double tt=xmu(a,ta);
//printf("ta:%.1lf %.1lf\n",ta.x,ta.y);
if(tt>0){
double cdu=dmu(a,ta)/dis(a)/dis(ta);
//puts("1");
if(M<cdu){
M=cdu;
f=1;
ans=i;
}
}
else if(tt<0){
double cdu=dmu(b,ta)/dis(b)/dis(ta);
if(M<cdu){
M=cdu;
f=2;
ans=i;
}
}
}
o=I;
I=ans;
if(j!=s)
printf("%d ",ans);
else
printf("%d\n",ans);
if(f==1)
{
b.x=P[o].x-P[I].x;
b.y=P[o].y-P[I].y;
a.x=-b.x;
a.y=-b.y;
}
else
{
a.x=P[o].x-P[I].x;
a.y=P[o].y-P[I].y;
b.x=-a.x;
b.y=-a.y;
}
}
}
}
/*
2
1 5 5 1 45
1 -1 1
2 1 1
3 0 0
4 -1 -2
5 1 -2
*/
H - Windmill Animation
最新推荐文章于 2014-09-28 18:57:59 发布