比赛 |
“Asm.Def战记之拉格朗日点”杯 |
评测结果 |
WWWWWWWWWW |
题目名称 |
Asm.Def找燃料 |
最终得分 |
0 |
用户昵称 |
pppoooiiizzy |
运行时间 |
0.057 s |
代码语言 |
C++ |
内存使用 |
0.32 MiB |
提交时间 |
2015-11-04 09:10:06 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<cmath>
const int maxn = 300;
using namespace std;
#define INF 0x3fffffff
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
return x * f;
}
struct poi {
double x, y;
}a[maxn];
int m, n, Ar, Sa;
int tot, cnt, sum, ans1, ans = -INF;
bool cmp(const poi i, const poi j) {
if( i.x != j.x) return i.x < j.x;
else return i.y < j.y;
}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
void init()
{
n = read();
for(int i = 1; i <= n; i++)
a[i].x = read(), a[i].y = read();
sort(a + 1, a + n + 1, cmp);
}
int main()
{
freopen("asm_fuel.in", "r", stdin);
freopen("asm_fuel.out", "w", stdout);
init();
for(int i = 1; i <= n; i++)
for(int j = 1; j <= n; j++) {
int now = 0;
if(a[j].x - a[i].x != 0) {
Ar = a[j].y - a[i].y;
Sa = a[j].x - a[i].x;
int lo = gcd(Ar, Sa);
Ar /= lo, Sa /= lo;
double b = a[i].y - Sa * a[i].x / Ar;
for(int h = 1; h <= n; h++) {
if(a[h].y == Sa * a[h].x / Ar + b)
now++;
}
}
else {
for(int k = 1; k <= n; k++)
if(a[k].x == a[j].x) now++;
}
ans = max(ans, now);
}
cout<<ans<<endl;
return 0;
}