| ||||||||||
| 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 | |||||||||
主要程序代码,哪位大侠帮忙看看..In Reply To:有什么数据嘛? n*n一直WA...5555 Posted by:dearboy at 2006-03-26 17:05:33 visit[2002][2002]存放斜率..
for( int i = 0 ; i < n; i++ )
{
for( int j = 0 ; j < n ; j ++ )
{
if(i==j)
continue;
int x = pv[i][0] - pv[j][0] ;
int y = pv[i][1] - pv[j][1] ;
if ( y == 0 )
{
tb[pv[i][1]] ++ ;
continue;
}
else if ( x == 0 )
{
ta[pv[i][0]] ++ ;
continue;
}
int temp = gcd( abs(x), abs(y) );
x /= temp , y /= temp;
if ( x < 0 )
x = - x , y = -y ;
visit[x+1001][y+1001] ++ ;
if ( best < visit[x+1001][y+1001] )
best = visit[x+1001][y+1001] ;
}
}
for( int i = 0 ; i < 1001 ; i ++)
if(tb[i]>best)
best=tb[i];
for( int i = 0 ; i < 1001 ; i ++)
if(ta[i]>best)
best=ta[i];
for(int i=2; i<=1000 ; i++)
if(i*(i-1)==best)
{
printf("%d\n" , i );
return;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator