Under construction

Still being built. Things may change

Darts

Interview

Time limit1sMemory limit256 MB

Summary
For each dart throw coordinate, determine the score based on concentric circle radius bands and sum the scores per test case.
Level

Easy3 of 10

Topics
Math, Implementation, Simulation
Solved
No attempts yet

Problem

Consider a game in which darts are thrown at a board. The board consists of 10 circles centered at the origin, with radii 20, 40, 60, 80, 100, 120, 140, 160, 180, and 200 (measured in millimeters). Each throw is scored according to where the dart lands. A throw earns p points (p ∈ {1, 2, …, 10}) if the smallest circle that encloses the hit point, or passes through it, has radius 20 · (11 − p). A throw that lands outside the largest circle earns no points.

Compute the total score of a series of n throws.

Input

The first line contains the number of test cases T. The test cases follow.

Each test case begins with a line containing the number of throws n (1 ≤ n ≤ 10^6). Each of the next n lines contains two integers x and y (−200 ≤ x, y ≤ 200), separated by a space — the coordinates of the point hit by one throw.

Output

For each test case, print the answer on its own line, in the order the test cases appear in the input. Each line contains a single integer — the sum of the scores of that test case's n throws.

Examples3

  1. Example 1

    Input
    1
    5
    32 -39
    71 89
    -60 80
    0 0
    196 89
    
    Expected output
    29
    
  2. Example 2

    Input
    1
    1
    0 0
    
    Expected output
    10
    
  3. Example 3

    Input
    1
    2
    141 141
    142 142
    
    Expected output
    1