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 |
WHY REIn Reply To:什么意思?我也快RE到吐血 Posted by:vince4053040 at 2010-02-18 15:36:20 #include<iostream> using namespace std; struct Hole { float row; float col; int num; }; Hole hole[702]; int N, sum; void dfs(float i_row, float i_col, int j, float k, int m) { if(j >= N) return ; for(int p = j; p < N; p ++) { if(m == 0) { if(hole[p].col - i_col == 0) sum ++; } else { //m == 1 if(hole[p].col - i_col == 0) continue; else { if((hole[p].row - i_row) / (hole[p].col - i_col) == k) sum ++; } } } return ; } int main() { //freopen("1118in.txt", "r", stdin); float k; int i, j, gg; int total[10000]; while(cin >> N && N) { for(i = 0; i < N; i ++) cin >> hole[i].row >> hole[i].col; if(N == 1) { cout << 1 << endl; break; } gg = 0; memset(total, 0, sizeof(total)); for(i = 0; i < N; i ++) { for(j = i + 1; j < N; j ++) { sum = 2; if(hole[j].col - hole[i].col == 0) { dfs(hole[i].row, hole[i].col, j + 1, 0, 0); //k在此处令为0 无意义 total[gg ++] = sum; } else { k = (hole[i].row - hole[j].row) / (hole[i].col - hole[j].col); dfs(hole[i].row, hole[i].col, j + 1, k, 1); total[gg ++] = sum; } } } int max = -1; for(i = 0; i < gg; i ++) { if(total[i] > max) max = total[i]; } cout << max << endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator