Description
考虑一个扔飞镖的游戏。板子由十个环组成,半径分别为20, 40, 60, 80, 100, 120, 140, 160, 180和200(单位:mm),均以原点为中心。每次投掷的得分取决于飞镖所击中的位置。如果包含飞镖的最小环(可以在圆上)的半径是20 * (11 - p),则得分是p。不在最外环以内的点不得分。你的任务是计算n次投掷之后的得分。
Input
第一行一个正整数T,表示有T组数据。
每组数据第一行一个正整数n,表示有n次投掷,1 <= n <= 10^6。
接下来n行,每行两个整数x和y,表示一次投掷击中的位置为(x, y),-200 <= x, y <= 200。
Output
对于每组数据输出一行,即n次投掷得分的总和。
Sample Input
1
5
32 -39
71 89
-60 80
0 0
196 89
Sample Output
29
HINT
Source
鸣谢Tjz
一开始理解错题意,样例过不去
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define GET (ch>='0'&&ch<='9')
using namespace std;
int T,n,x,y,r;
int ans;
void in(int &x)
{
char ch=getchar();x=0;int flag=1;
while (!GET) flag=(ch=='-')?-1:1,ch=getchar();
while (GET) x=x*10+ch-'0',ch=getchar();x*=flag;
}
int main()
{
in(T);
while (T--)
{
ans=0;
in(n);
while (n--)
{
in(x);in(y);double r=sqrt(x*x+y*y);
int p=1;
while (20*(11-p)>=r&&p<=10) p++;
ans+=p-1;
}
printf("%d\n",ans);
}
}