eolymp
bolt
Try our new interface for solving problems

Darts

Consider a game in which darts are thrown at a board. The board is formed by \textbf{10} circles with radii \textbf{20}, \textbf{40}, \textbf{60}, \textbf{80}, \textbf{100}, \textbf{120}, \textbf{140}, \textbf{160}, \textbf{180} and \textbf{200 }(measured in millimeters), centered at the origin. Each throw is evaluated depending on where the dart hits the board. The score is \textbf{p} points (\textbf{p} ∈\{\textbf{1}, \textbf{2},..., \textbf{10}\}) if the smallest circle enclosing or passing through the hit point is the one with radius \textbf{20·(11−p)}. No points are awarded for a throw that misses the largest circle. Your task is to compute the total score of a series of \textbf{n} throws. \InputFile The first line of the input contains the number of test cases \textbf{T}. The descriptions of the test cases follow: Each test case starts with a line containing the number of throws \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{10^6}). Each of the next \textbf{n} lines contains two integers \textbf{x} and \textbf{y} (\textbf{−200} ≤ \textbf{x}, \textbf{y} ≤ \textbf{200}) separated by a space --- the coordinates of the point hit by a throw. \OutputFile Print the answers to the test cases in the order in which they appear in the input. For each test case print a single line containing one integer --- the sum of the scores of all \textbf{n} throws.
Zaman məhdudiyyəti 3 saniyə
Yaddaşı istafadə məhdudiyyəti 256 MiB
Giriş verilənləri #1
1
5
32 -39
71 89
-60 80
0 0
196 89
Çıxış verilənləri #1
29
Mənbə Central Europe Regional Contest 2012, Kraków, November 16-18, 2012