hihocoder 1064 時間結界 掃瞄線

2021-06-26 03:31:25 字數 1145 閱讀 1364

題目描述:二維平面有 n個點,(n<=2000)座標範圍是[-10,10],每個點有乙個權值,問乙個單位圓最多能覆蓋的最大權值是多少

解題思路:列舉每乙個點,以這個點作為單位圓上的一點(也就是邊界上的點),然後這個單位圓相當於固定了乙個點,然後逆時針或順時針做掃瞄線。維護乙個最大值。

其實在做掃瞄線之前,需要先處理出乙個結構體來,乙個是角度——用來排序,乙個是權值——用來維護答案

不過真的漲姿勢了,居然有atan2(y,x)這麼神奇的函式,省的自己寫了。。。

弱渣就是弱渣,即使想出演算法,還是不能ac

//#pragma comment(linker,"/stack:102400000,102400000")

#include#include#include#include#include#include#include#include#include#include#define ll long long

#define db double

#define pb push_back

#define lson k<<1

#define rson k<<1|1

using namespace std;

const int n = 2005;

const db pi = acos(-1.0);

const db eps = 1e-8;

int sgn(db t)

struct point

void input()

db len2()

db len()

point operator - (const point &t) const

bool operator == (const point &t) const

db operator * (const point &t) const

}p[n];

struct node

else if(sgn(d-2.0)<0)

//

// }}}

sort(jd,jd+ln);

int mm=nw;

// printf("***********\n");

// for(int j=0;j

2012 07 21 時間控制項

1 當天工作情況 1.class wdate onfocus wdatepicker 對時間控制項wdatepicker的使用。2.對時間控制項控制日期的有效性,有mindate和maxdate.3.span和select option重疊後形成的可輸入文字下拉列表,由於採用的是定位加外邊距壓縮。考...

759 時間角度

759.時間角度 中文english 計算在時鐘中以 h m 時刻的時針和分針之間的角度。example 1 input h 12,m 0.output 0example 2 input h 1,m 0.output 30 時針與分針之間的角度小於180度 class solution param ...

2670 時間計算

時間限制 2 s 空間限制 32000 kb 題目等級 gold 題解檢視執行結果 假設現在是2013年1月1日0 00分00秒,現在給出乙個秒數s,求過s秒後時那年那月那日幾時幾分幾秒.設每月30天 輸入描述 input description 多資料 每行乙個正整數s,當s 0時,輸入結束。輸出...