bzoj4063 水题

bzoj4063 水题
 1 #include<iostream>

 2 #include<cstdio>

 3 #include<cstring>

 4 #include<cstdlib>

 5 #include<cmath>

 6 #include<algorithm>

 7 using namespace std;

 8 

 9 int main()

10 {

11     int t;

12     cin>>t;

13     while(t--){

14         int n,s=0;

15         scanf("%d",&n);

16         while(n--){

17             int x,y;

18             scanf("%d%d",&x,&y);

19             int k=1;

20             double r=sqrt(x*x+y*y);

21             while(20*(11-k)>=r&&k<=10) k++;

22             s+=k-1;

23         }

24         printf("%d\n",s);

25     }

26     return 0;

27 }
View Code

4063: [Cerc2012]Darts

Time Limit: 10 Sec  Memory Limit: 128 MB
Submit: 185  Solved: 126
[Submit][Status][Discuss]

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

[ Submit][ Status][ Discuss]

你可能感兴趣的:(ZOJ)