#include#include#includeusingnamespacestd;#defineeps1e-8structpoint{doublex,y;}s;doublegetangle(pointa){returnatan2(a.y,a.x);}doublexmult(pointp1,pointp2,pointp0){return(p1." />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

poj2007

系統(tǒng) 2092 0

極角排序,其實(shí)是叉乘排序

?

    #include <iostream>

#include <algorithm>

#include <math.h>

#include <vector>



using namespace std;



#define eps 1e-8



struct point

{

	double x, y;

} s;



double getangle(point a)

{

	return atan2(a.y, a.x);

}

double xmult(point p1, point p2, point p0)

{

	return (p1.x - p0.x)*(p2.y - p0.y) - (p2.x - p0.x)*(p1.y - p0.y);

}

bool operator < (point a, point b)

{

	return xmult(a, b, s) > eps;

}



int main()

{

	vector<point> p;

	double a, b;

	//freopen("D:\\b.txt", "r", stdin);

	cin >> s.x >> s.y;

	while (cin >> a >> b)

	{

		point temp;

		temp.x = a, temp.y = b;

		p.push_back(temp);

	}

	sort(p.begin(), p.end());

	cout << "(0,0)" << endl;

	for (vector<point>::iterator it = p.begin(); it != p.end(); ++it)

	{

		cout << '(' << (*it).x << ',' << (*it).y << ')' << endl;

	}

}
  


?

?

poj2007


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 通化县| 厦门市| 慈溪市| 通州区| 溧水县| 鸡西市| 呼和浩特市| 绥阳县| 辉县市| 确山县| 永安市| 广南县| 丰城市| 浪卡子县| 萝北县| 富川| 潞西市| 浑源县| 汉寿县| 西昌市| 湾仔区| 鹿泉市| 海盐县| 东至县| 昭平县| 醴陵市| 惠东县| 鹤峰县| 东源县| 五常市| 江西省| 会昌县| 博白县| 阜南县| 石景山区| 屏边| 乐山市| 肇东市| 敦煌市| 泗阳县| 中西区|