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:52题留念!付水代码!In Reply To:52题留念!付水代码! Posted by:woshiliyiyiyiyi at 2012-06-21 00:06:31 > #include<iostream> > > using namespace std; > #define N 702 > > class test > { > private: > int xi[N], yi[N]; > int number; > public: > void set(int n); > int each(int i, int j, int k); > void fun(); > }; > > void test::set(int n) > { > int i; > > number = n; > for (i=0; i<number; i++) > { > cin >> xi[i] >> yi[i]; > } > } > > int test::each(int i, int j, int k) > { > int a1, b1; > int a2, b2; > > a1 = xi[j] - xi[i]; b1 = yi[j] - yi[i]; > a2 = xi[k] - xi[i]; b2 = yi[k] - yi[i]; > > return (a1 * b2) - (a2 * b1); > } > > void test::fun() > { > int i, j, k; > int pointNumber; > int Rpoint; > > pointNumber = 2; > for (i=0; i<number-2; i++) > { > for (j=i+1; j<number; j++) > { > Rpoint = 2; > for (k=j+1; k<number; k++) > { > if (!each(i, j, k)) > Rpoint++; > } > if (Rpoint > pointNumber) > { > pointNumber = Rpoint; > } > } > } > cout << pointNumber << endl; > } > > int main() > { > int count; > test Point; > > cin >> count; > Point.set(count); > Point.fun(); > > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator