题目地址:LA6262
一个A+B水题
关键就是浮点数的处理
很担心恰好在某一条半径上啊。 觉得ceil(r-eps) 比较靠谱,防止刚好相同被当做超过了一点点。
#include<iostream>
#include<cmath>
#include<cstdio>
const double eps=1e-8;
using namespace std;
struct Point
{
double x;
double y;
Point(double x=0,double y=0):x(x),y(y) {}
};
//int getPoint(int x,int y)
//{
// for(int i=1;i<=10;i++)
//
//}
int n;
int main()
{
int T;
cin>>T;
while(T--)
{
cin>>n;
long long ans=0;
double x,y;
for(int i=0;i<n;i++)
{
scanf("%lf%lf",&x,&y);
double r=sqrt(x*x+y*y);
r/=20;
int p=ceil(r-eps);
if(!p) ans+=10;
else if(p<=10)
ans+=11-p;
}
cout<<ans<<endl;
}
}
//struct Point
//{
// int x;
// int y;
// Point(int x=0,int y=0) :x(x),y(y) {}
//
//};
//
//Point p[5005];
//
//int main()
//{
//
//}