比赛 |
20120416 |
评测结果 |
AAAAAAATTT |
题目名称 |
牛类刺绣 |
最终得分 |
70 |
用户昵称 |
Makazeu |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2012-04-16 10:56:56 |
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define db double
using namespace std;
const int MAXN=50001;
int N; db D; int ans=0;
class LINE
{
public:
db a,b,c; int flag;
void read() {scanf("%lf %lf %lf\n",&a,&b,&c); flag=1;}
void on() {if(distance()>D*D) flag=0;}
private:
db distance() {db ans=(c*c)/(a*a+b*b); return ans;}
}L[MAXN];
int main()
{
freopen("cowemb.in","r",stdin);
freopen("cowemb.out","w",stdout);
scanf("%d %lf\n",&N,&D);
for(int i=1;i<=N;i++) {L[i].read(); L[i].on();}
db x1,x2,y1,y2,dx,dy,dst;
for(int i=1;i<=N;i++)
{
if(!L[i].flag) continue;
for(int j=1;j<i;j++)
{
if(!L[j].flag) continue;
x2=L[i].a*L[j].b-L[j].a*L[i].b;
if(x2==y2) continue;
x1=(-L[i].c)*(L[j].b)+L[j].c*L[i].b;
y1=(-L[i].c)*(L[j].a)+L[j].c*L[i].a;
dx=x1/x2; dy=y1/x2;
dst=dx*dx+dy*dy;
if(dst<=D*D) ans++;
}
}
printf("%d\n",ans);
return 0;
}