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 |
终于AC了30个题 纪念一下...... 继续加油 附代码和1118是一样的,直接copy过来了 #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <iostream> #include <map> #include <set> #include <list> #include <queue> #include <stack> #include <vector> #include <assert.h> using namespace std; #define SIZE 1000 int main() { int Psum[SIZE][2]; int N,Max; scanf("%d",&N); Max=0; for(int i=0;i<N; i++){ scanf("%d%d",&Psum[i][0],&Psum[i][1]); } //枚举的时候应该注意 先确定两个点 从而确定一条直线 再判断第三个点是否在这条直线上 for(int i=0;i<N;i++){ for(int j=i+1;j<N;j++){ int sum=0; for(int k=j+1; k<N; k++) if((Psum[i][0]-Psum[j][0])*(Psum[i][1]-Psum[k][1]) == (Psum[i][0]-Psum[k][0])*(Psum[i][1]-Psum[j][1])) sum++; if(Max<sum) Max=sum; } } printf("%d\n",Max+2);//注意细节 return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator