Rezultati

Up. imeNalogaJezikRezultatČas oddaje
schrutefarms-2018 Fruit Ninja Python 3 0/100Napaka med izvajanjem / ob izhodu (RTE) 13. okt '18 @ 15:29

Test Točke Porabljen spomin Porabljen čas Status
#1 11/11 8,734 MiB 0,000 s OK
#2 0/11 8,602 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 12, in <module>
    d =(yb-ya)/(xb-xa)
ZeroDivisionError: division by zero
#3 11/11 8,707 MiB 0,000 s OK
#4 11/11 8,766 MiB 0,000 s OK
#5 0/11 8,582 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 12, in <module>
    d =(yb-ya)/(xb-xa)
ZeroDivisionError: division by zero
#6 0/11 8,805 MiB 0,000 s Napačen odgovor
Tvoj izhod:
​0
<<<EOF>>>
Pravilen izhod:
​37
<<<EOF>>>
#7 0/11 8,840 MiB 0,000 s Napačen odgovor
Tvoj izhod:
​0
<<<EOF>>>
Pravilen izhod:
​236
<<<EOF>>>
#8 11/11 8,703 MiB 0,000 s OK
#9 0/12 8,840 MiB 0,000 s Napačen odgovor
Tvoj izhod:
​0
<<<EOF>>>
Pravilen izhod:
​638
<<<EOF>>>

Ocenjevani program (tiest.py):
import sys
f = sys.stdin
#f = open("test", "r")
lines = f.read().strip().split("\n")
x = lines[0].split(" ")
xa,  ya,  xb,  yb = int(x[0]),  int(x[1]),  int(x[2]),  int(x[3])

count = 0
for line in lines[2:]:
    y = line.split(" ")
    ra,  rb , r = int(y[0]),  int(y[1]),  int(y[2])
    d =(yb-ya)/(xb-xa)
    c = rb - ya + d*xa 
    determinant = (2*(ra+c*d))**2 - 4*(d**2+1)*(ra**2+c**2-r**2)
    if determinant >= 0:
        x1 = (2*(ra+c*d)+determinant**0.5)/(2*(d**2+1))
        x2 = (2*(ra+c*d)-determinant**0.5)/(2*(d**2+1))
        if (x1>=xa and x1<=xb) or (x2>=xa and x2<=xb):
           count+=1 
print(count)           
f.close()