1 / 3
May 2011

Hello everyone, one of the moderators of SPOJPL advised me to ask here about my problem. So ...
I wrote a program that is checking if the given points lies outside, inside or the edge of the circle. There's a example:
Output:
5 (x-position of circle) 5 (y-position of circle) 2 (radius)
4 (tests)
0 0 (x,y-position of points)
6 5
5 7
5 5
Output:
O
I
E
I
And my program:
[bbone=PYTHON,183]import math,sys

x,y,r=map(int,raw_input().split())
t=input()
for i in range(t):
xi,yi=map(int,raw_input().split())
d=math.sqrt((yi-y)(yi-y)+(x-xi)(x-xi))
if d==r:
print "E"
elif d print "I"
elif d>r:
print "O"
sys.exit(0)[/bbone]
The problem is that my program gets NZEC confused
Do you have any idea what's causing this error ?

Sorry for my bad english, I don't use this language usually smile

  • created

    May '11
  • last reply

    May '11
  • 2

    replies

  • 192

    views

  • 2

    users

I suppose you use Python 2.x.
Then you should replace the input(), which produces a NZEC, if input data has \r as EOL.

Independent from that:
1. sys.exit() isn't needed, so module sys isn't needed
2. The progamm will probably not work correctly for all input because of the sqrt and the resulting floating point issues.
So, avoid sqrt and do it with integers.

Thank you very much !
Replacing input() with int(raw_input()) worked smile