qq_37242775 于 2017.01.04 12:06 提问

POJ 1626 有程序求解析。！！！！！！ 30C

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long lld;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define eps 1e-8
#define pi acos(-1.0)
int Sig(double a)
{
if(a < -eps)
return -1;
return a > eps;
}
struct Point
{
double x,y;
Point(){}
Point(double x0,double y0):x(x0),y(y0){}
void in()
{
scanf("%lf %lf",&x,&y);
}
double len()
{
return sqrt(x*x+y*y);
}
Point operator -(Point pt)
{
return Point(x-pt.x,y-pt.y);
}
};
struct Edge
{
int v,next;
}edge[1000010];
int pos;
void insert(int x,int y)
{
edge[pos].v=y;
}
bool in[20];
struct Event
{
double s;
int flag,id;
Event(){}
Event(double s0,int flag0,int id0):s(s0),flag(flag0),id(id0){}
}pp[110];
int qq;
bool cmp(Event a,Event b)
{
return a.s < b.s;
}
Point p[110];
int T1,T2;
int dp[1< int dfs(int mask,int flag)
{
if(flag == 0)
{
return 0;
{
int to=edge[i].v;
next|=1 next^=1 next|=to;
next^=to;
if(!dfs(next,flag^1))
{
return 1;
}
}
}
return 0;
}
else
{
return 0;
{
int to=edge[i].v;
next|=1 next^=1 next|=to;
next^=to;
if(!dfs(next,flag^1))
{
return 1;
}
}
}
return 0;
}
return (int)"you are so pretty";
}
int main()
{
T1=T2=0;
for(int i=0;i T1+=1 for(i=8;i T2+=1 while(scanf("%lf %lf",&p[0].x,&p[0].y)!=EOF)
{
for(int i=1;i p[i].in();
pos=1;
for(i=0;i {
qq=0;
int T=0;
memset(in,false,sizeof(in));
for(int j=0;j {
if(i == j)
continue;
double d=(p[i]-p[j]).len();
double angle=atan2(p[j].y-p[i].y,p[j].x-p[i].x);
}
for(j=0;j {
while(pp[j].s pp[j].s+=pi*2;
while(pp[j].s > pi*2)
pp[j].s-=pi*2;
}
sort(pp,pp+qq,cmp);
for(j=0;j<qq;j++)
{
int id=pp[j].id;
if(pp[j].flag == -1)
in[id]=true;
else
in[id]=false;
}
for(j=0;j<qq;j++)
{
int id=pp[j].id;
for(int k=0;k<16;k++)
if(in[k])
if(pp[j].flag == -1)
in[id]=true;
else
in[id]=false;

``````        }
}
memset(dp,-1,sizeof(dp));
if(dfs((1<<16)-1,0))
printf("RED\n");
else
printf("WHITE\n");
}
return 0;
``````

}

1个回答

dabocaiqq   2017.01.14 23:21