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 |
n^3 REIn Reply To:DFS 也RE 暴力也RE Posted by:4053040 at 2010-02-18 16:21:32 #include<iostream> using namespace std; struct Combine { int row; int col; }; Combine combine[702]; int main() { int N, i, j, p, sum; int total[50000]; while(cin >> N && N ) { for(i = 0; i < N; i ++) scanf("%d%d", &combine[i].row, &combine[i].col); //cin >> combine[i].row >> combine[i].col; int gg = 0; memset(total, 0, sizeof(total)); if(N == 1) { printf("1\n"); break; } for(i = 0; i < N; i ++) { for(j = i + 1; j < N; j ++) { sum = 2; for(p = j + 1; p < N; p ++) { if(combine[i].row * combine[p].col == combine[i].col * combine[p].row) //(x1, y1), (x2, y2) 计算 x1*y2 == x2*y1 sum ++; } total[gg ++] = sum; } } int max = -1; for(i = 0; i < gg; i ++) { if(total[i] > max) max = total[i]; } printf("%d\n", max); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator