比赛 “Asm.Def战记之拉格朗日点”杯 评测结果 AAAAAAAAAA
题目名称 Asm.Def找燃料 最终得分 100
用户昵称 Binary10 运行时间 0.010 s
代码语言 C++ 内存使用 0.29 MiB
提交时间 2015-11-04 10:43:07
显示代码纯文本
#include<cstdio>
#include<algorithm>
#include<utility>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 110;
pii a[maxn];
int n, ans = 0;
int main()
{
  freopen("asm_fuel.in", "r", stdin);
  freopen("asm_fuel.out", "w", stdout);
  scanf("%d", &n);
  int x, y;
  for(int i = 1; i <= n; i++){
    scanf("%d%d", &x, &y);
    a[i] = make_pair(x, y);
  }
  sort(a + 1, a + 1 + n);
  int x1, y1, x2, y2, x3, y3, cnt;
  for(int i = 1; i < n; i++)
    for(int j = i + 1; j <= n; j++){
      if(a[i] == a[j]) continue;
      x1 = a[i].first; y1 = a[i].second;
      x2 = a[j].first; y2 = a[j].second;
      cnt = 0;
      for(int k = 1; k <= n; k++){
        x3 = a[k].first; y3 = a[k].second;
        if((x1 - x2) * (y1 - y3) == (y1 - y2) * (x1 - x3)) cnt++;
      }
      if(cnt > ans) ans = cnt;
    }
  printf("%d\n", ans);
  return 0;
}