2009年11月13日星期五.sgu486 sgu488 sgu496
2009年11月13日星期五.sgu486 sgu488 sgu496今天去上午去實(shí)驗(yàn)室找老師,下午買了點(diǎn)咳嗽藥,睡了很久,晚上查了查明天去北京的路線,
然后才起來今天還沒做題....
上次sgu比賽沒看到。。。
昨天wanbo說上次比賽中看到大家切題跟切菜一樣,于是就看看,挑了三個(gè)過的人數(shù)多的,
都是簡單題,3個(gè)1Y,Oh yeah,今天早睡,明天去北京見騰訊校園關(guān)系部的那個(gè)姐姐..
sgu486: Bulls and Cows簡單題
sgu488: Dales and Hills 動(dòng)態(tài)規(guī)劃
O(n)的掃描,四個(gè)數(shù)組
LU ^ ^ RU
/ \
/ \
/ \
\ /
\ /
\ /
LD v v RD
邊界條件考慮好,搞清關(guān)系即可
sgu496:496 L-Shapes計(jì)算幾何
點(diǎn)積判零即可
貼些代碼,計(jì)算幾何苦手可以試試這種風(fēng)格。
const int N = 5050;
struct point_t { //struct 最好加_t以示清晰,加多了就習(xí)慣了
int x,y;
point_t(){}
point_t(int a,int b){x = a,y = b;}
}L[N][2];
point_t operator + (point_t a,point_t b) { return point_t (a.x + b.x,a.y + b.y);}
point_t operator - (point_t a,point_t b) { return point_t (a.x - b.x,a.y - b.y);}
bool operator == (point_t a,point_t b) { return a.x == b.x && a.y == b.y;}
int dot_mul(point_t a,point_t b) { return a.x * b.x + a.y * b.y;}
bool isvertical(point_t a,point_t b,point_t c) { return dot_mul(a-b,b-c) == 0; }
posted on 2009-11-13 22:41 schindlerlee 閱讀(1211) 評論(0) 編輯 收藏 引用 所屬分類: 解題報(bào)告