| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
帮忙啊,WA中 ... 郁闷#include <iostream>
#include <algorithm>
using namespace std;
struct pt
{
int x,y,q;
float m;
};
bool co(pt a,pt b)
{
if (a.q!=b.q)
return a.q>b.q;
return a.m<b.m;
}
bool coo(pt a,pt b)
{
if (a.q!=b.q)
{
if (a.q==2)
return a.q<b.q;
if (b.q==2)
return b.q<a.q;
if (a.q==1)
return a.q<b.q;
if (b.q==1)
return b.q<a.q;
if (a.q==4)
return a.q<b.q;
if (b.q==4)
return b.q<a.q;
}
return a.m<b.m;
}
int main()
{
pt p[50];
int n;
cin>>n;
int c=0;
cin>>c>>c;
while (n--)
{
c=0;
bool t=0,u=0;
while (cin>>p[c].x>>p[c].y)
{
if (p[c].x==0)
break;
p[c].m=p[c].y*1.0/p[c].x;
if (p[c].x>0&&p[c].y>0)
p[c].q=1,t=1;
if (p[c].x>0&&p[c].y<0)
p[c].q=2;
if (p[c].x<0&&p[c].y<0)
p[c].q=3;
if (p[c].x<0&&p[c].y>0)
p[c].q=4,u=1;
c++;
}
sort(p,p+c,co);
if (t&&u)
sort(p,p+c,coo);
cout<<"(0,0)\n";
for (int i=0;i<c;i++)
cout<<"("<<p[i].x<<','<<p[i].y<<")\n";
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator