#include<iostream> #include<map> #include<vector> using namespace std; //y=kx+z typedef struct{ double k; double z; int count; }Skzc; int main(int argc, char *argv[]){ //(x,y) multimap<int,int> place; vector<Skzc> kzcVector; map<int, int> countMap; int inputCunt; int x,y; int verticalFlyCunt=0; Skzc kzc; bool findFlag=false; int resultCount=1; while(cin>>inputCunt && inputCunt!=0){ //cin>>inputCunt; if(inputCunt==0){ break; } for(int i=0;i<inputCunt;i++){ cin>>x>>y; for(multimap<int, int>::iterator iter1=place.begin(); iter1!=place.end(); ++iter1){ if(x-iter1->first==0){ verticalFlyCunt++; }else{ kzc.k=1.0*(y-iter1->second)/(x-iter1->first); kzc.z=y-kzc.k*x; for(vector<Skzc>::iterator iter2=kzcVector.begin(); iter2!=kzcVector.end(); ++iter2){ if(iter2->k==kzc.k && iter2->z==kzc.z){ iter2->count++; if(iter2->count>resultCount){ resultCount=iter2->count; } findFlag=true; break; }else{ findFlag=false; } } if(findFlag==false){ kzc.count=1; kzcVector.push_back(kzc); } } } place.insert(pair<int,int>(x,y)); } if(resultCount>verticalFlyCunt){ cout<<resultCount<<endl; }else{ cout<<verticalFlyCunt<<endl; } } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-11 22:23:27