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 |
无故WA, 找不到通不过的测试数据,求救/* Problem: 2606 User: jibee Memory: N/A Time: N/A Language: C++ Result: Wrong Answer */ #include <iostream> #include <vector> using namespace std; const int MAX = 210; int theX[MAX]; int theY[MAX]; struct Line{ Line( int x1v, int y1v, int x2v, int y2v, int numVal = 2 ) : x1( x1v ), y1( y1v ), x2( x2v ), y2 ( y2v ), num( numVal ) {} bool lie( int x, int y ){ return ( x1 - x ) * ( y -y2 ) - ( x - x2 ) * ( y1 - y ) == 0; } int x1; int y1; int x2; int y2; int num; }; int main(){ int num; cin >> num; int x,y; vector<Line> vl; vector<Line>::iterator iter; for ( int k = 0; k < num; k++ ){ cin >> theX[k] >> theY[k]; for( iter = vl.begin(); iter != vl.end(); iter ++ ){ if( iter -> lie( theX[k],theY[k] )){ iter -> num ++; break; } } if( iter == vl.end() ){ for( int j = 0; j < k; j ++ ){ Line l ( theX[j], theY[j], theX[k], theY[k] ); vl.push_back( l ); } } } int m = 0; for( iter = vl.begin(); iter != vl.end(); iter ++ ) if ( iter -> num > m ) m = iter -> num; cout << m; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator