Advertisement
Guest User

codechef obstacle course

a guest
Jun 17th, 2012
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import sys
  2. import math
  3. def main():
  4.     answers =[]
  5.     test_cases = int(raw_input())
  6.     for i in range(test_cases):
  7.         raw_input()
  8.         dist = []
  9.         radii = raw_input().split(' ')
  10.         r = int(radii[0])
  11.         R = int(radii[1])
  12.         no_of_cones = int(raw_input())
  13.         for j in range(no_of_cones):
  14.             pos = raw_input().split(' ')
  15.             x = int(pos[0])
  16.             y = int(pos[1])
  17.             d = math.sqrt(x*x+y*y)
  18.             dist.append(max(R-d,d-r))
  19.         answers.append(min(dist))
  20.     for answer in answers: print '%.3f' % answer
  21.  
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement