比赛 |
20120416 |
评测结果 |
AWWWWWTTTT |
题目名称 |
牛类刺绣 |
最终得分 |
10 |
用户昵称 |
TBK |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2012-04-16 10:17:28 |
显示代码纯文本
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <set>
#include <algorithm>
using namespace std;
int a[50000][3],b,c,d,x;
bool bo[50000];
double l,m,n,y,z;
long long s;
int main(void)
{
freopen("cowemb.in","r",stdin);
freopen("cowemb.out","w",stdout);
scanf("%d%d",&b,&c);
for (d=0;d<b;d++) scanf("%d%d%d",&a[d][0],&a[d][1],&a[d][2]);
for (d=0;d<b;d++)
{
l=(double)(fabs((double)a[d][2])/sqrt((double)(a[d][0]*a[d][0]+a[d][1]*a[d][1])));
if (l>(double)c) bo[d]=true;
}
for (d=0;d<b-1;d++)
{
if (bo[d]==true) continue;
for (x=d+1;x<b;x++)
if (bo[x]!=true)
{
if (a[d][1]!=0) l=(double)((double)a[d][0]/(double)a[d][1]);
else l=-1;
if (a[x][1]!=0) m=(double)((double)a[x][0]/(double)a[x][1]);
else m=-1;
if (l==m) continue;
if (a[x][1]!=0)
{
l=(double)((double)a[d][1]/(double)a[x][1]);
m=(double)a[x][0]*l;
n=(double)a[x][2]*l;
y=(double)((n-(double)a[d][2])/(m-(double)a[d][0]));
if (a[d][1]!=0) z=(double)((double)(0.0-(double)a[d][0]*y-(double)a[d][2])/(double)a[d][1]);
else z=(double)((double)(0.0-(double)a[x][0]*y-(double)a[x][2])/(double)a[x][1]);
}
else
{
y=(double)((double)(0.0-(double)a[d][2])/(double)a[d][0]);
z=(double)((double)(0.0-(double)a[d][0]*y-(double)a[d][2])/(double)a[d][1]);
}
l=sqrt(y*y+z*z);
if (l<=(double)c) s++;
}
}
printf("%lld",s);
fclose(stdin);
fclose(stdout);
return 0;
}