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

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

poj2007

系統(tǒng) 2162 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ì)非常 感謝您的哦?。。?/p>

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 泽州县| 墨江| 和静县| 木兰县| 秭归县| 洪泽县| 金阳县| 滦南县| 新河县| 都江堰市| 海盐县| 阜城县| 新平| 全椒县| 历史| 白朗县| 永昌县| 大埔县| 乡宁县| 韩城市| 台州市| 二手房| 界首市| 大竹县| 邳州市| 新乡县| 库车县| 灵石县| 石台县| 绥芬河市| 江西省| 南丰县| 广河县| 阜平县| 若羌县| 五莲县| 义马市| 新和县| 孝感市| 西藏| 龙州县|