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 |
Re:简单水过很不爽。。。In Reply To:简单水过很不爽。。。 Posted by:200831000423 at 2010-04-29 19:33:21 那就想想怎么优化呗 > #include<iostream> > #include<cstdlib> > #include<cstdio> > using namespace std; > > const int LEN = 700; > int x[LEN], y[LEN]; > > void solve(int n) { > int max(0), temp_max(0); > for (int i = 0; i < n; ++i) { > for (int j = i + 1; j < n; ++j) { > temp_max = 0; > for (int k = j + 1; k < n; ++k) { > if ((x[k] - x[i])*(y[j] - y[i]) == (x[j] - x[i])*(y[k] - y[i])) > ++temp_max; > } > max = max > temp_max ? max : temp_max; > } > } > cout << max + 2 << endl; > } > > int main() { > int cases; > while (scanf("%d", &cases) && cases) { > for (int i = 0; i < cases; ++i) > scanf("%d%d", x + i, y + i); > solve(cases); > } > return EXIT_SUCCESS; > } > > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator