比赛 |
“Asm.Def战记之拉格朗日点”杯 |
评测结果 |
WWWWWWWAWW |
题目名称 |
Asm.Def找燃料 |
最终得分 |
10 |
用户昵称 |
VG|Kn. |
运行时间 |
0.021 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2015-11-04 09:08:24 |
显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
int n;
double k, b;
int cnt = 0, maxs = 0;
struct node
{
int x;
int y;
}s[200];
int main()
{
freopen("asm_fuel.in","r",stdin);
freopen("asm_fuel.out","w",stdout);
cin >> n;
for (int i = 1; i <= n; i++)
cin >> s[i].x >> s[i].y;
for (int i = 1; i < n; i++)
for (int j = i+1; j <= n; j++)
{
cnt = 0;
if (s[i].x - s[j].x == 0)
{
for (int h = 1; h <= n; h++)
{
if (s[h].x == s[i].x)
cnt++;
}
}
else if (s[i].y - s[j].y == 0)
{
for (int h = 1; h <= n; h++)
{
if (s[h].y == s[i].y)
cnt++;
}
}
else
{
k = (s[i].y - s[j].y) / (s[i].x - s[j].x);
b = s[i].y - k * s[i].x;
for (int h = 1; h <= n; h++)
{
if (s[h].x * k + b == s[h].y)
cnt++;
}
}
if (cnt > maxs)
maxs = cnt;
}
cout << maxs;
return 0;
}