比赛 |
20161114 |
评测结果 |
EEEEEEEEEE |
题目名称 |
输出全靠花 |
最终得分 |
0 |
用户昵称 |
Tabing010102 |
运行时间 |
0.751 s |
代码语言 |
C++ |
内存使用 |
0.30 MiB |
提交时间 |
2016-11-14 11:38:51 |
显示代码纯文本
#include <cstdio>
#include <cstdlib>
using namespace std;
const double eps = 1e-4;
const int maxn = 1000+10;
FILE *fin, *fout;
struct Node {
int x, y, z, w;
Node(int a, int b, int c, int d) { x=a; y=b; z=c; w=d; }
Node(){;}
}nodes[maxn];
int n, ans=2;
double abs(double a) { return a<0?-a:a; }
bool isal(int a, int b, int c) {
double k1 = (nodes[c].x-nodes[a].x)/(nodes[b].x-nodes[a].x);
double k2 = (nodes[c].y-nodes[a].y)/(nodes[b].y-nodes[a].y);
double k3 = (nodes[c].z-nodes[a].z)/(nodes[b].z-nodes[a].z);
double k4 = (nodes[c].w-nodes[a].w)/(nodes[b].w-nodes[a].w);
return ((abs(k1-k2)<=eps) && (abs(k2-k3)<=eps)
&& (abs(k3-k4)<=eps) && (abs(k4-k1)<=eps));
}
int main() {
fin = fopen("xumingshi.in", "r");
fout = fopen("xumingshi.out", "w");
fscanf(fin, "%d", &n);
if(n <= 2) { fprintf(fout, "%d\n", n); exit(0); }
for(int i = 1; i <= n; i++) {
int a, b, c, d;
fscanf(fin, "%d%d%d%d", &a, &b, &c, &d);
nodes[i] = Node(a, b, c, d);
}
for(int i = 1; i <= n-2; i++) for(int j = i+1; j <= n-1; j++) {
if(ans-2 > n-j) break;
int tmp = 2;
for(int k = j+1; k <= n; k++) if(isal(i, j, k)) tmp++;
if(tmp > ans) ans = tmp;
}
fprintf(fout, "%d\n", ans);
return 0;
}