-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDarts.cpp
44 lines (35 loc) · 803 Bytes
/
Darts.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
template<typename T> T gcd(T a, T b) {
if(!b) return a;
return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
return a * b / gcd(a, b);
}
template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }
using namespace std;
typedef long long Int;
typedef unsigned uint;
const double EPS = 1e-7;
int T, N;
int main(void) {
cin >> T;
for (int t = 1; t <= T; t++) {
cin >> N;
int ans = 0, x, y;
for (int i = 0; i < N; i++) {
cin >> x >> y;
double dst = hypot(x, y);
for (int j = 10; j >= 1; j--) {
if (dst <= 20. * (11. - j)) {
ans += j;
break;
}
}
}
printf("%d\n", ans);
}
return 0;
}