Rezultati

Up. imeNalogaJezikRezultatČas oddaje
kjejenovictk-2018 Presek Python 3 100/100OK 04. okt '18 @ 17:50

Test Točke Porabljen spomin Porabljen čas Status
#1 100/100 8,621 MiB 0,000 s OK

Ocenjevani program (prva.py):
import sys
#data = open("presekTest.txt").readlines()[1:]
data = sys.stdin.readlines()[1:]

for podatki in data:
    podatek = list(map(float,podatki.strip().split()))
    x1,y1,x2,y2,xr,yr,r = podatek
    if xr>=x1 and xr<=x2 and yr>=y1 and yr<=y2:
        #print(1)
        print(xr,yr)
        continue
    elif abs(x1-xr) <= r and yr>=y1 and yr<=y2:
        #print(2)
        print(x1,yr)
        continue
    elif abs(xr-x2) <= r and yr>=y1 and yr<=y2:
        #print(3)
        print(x2,yr)
        continue
    elif abs(yr-y2) <= r and xr>=x1 and xr<=x2:
        #print(4)
        print(xr,y2)
        continue
    elif abs(y1-yr) <= r and xr>=x1 and xr<=x2:
        #print(5)
        print(xr,y1)
        continue
    elif (xr-x1)**2 + (yr-y1)**2 <= r*r:
        #print(6)
        print(x1,y1)
        continue
    elif (xr-x1)**2 + (yr-y2)**2 <= r*r:
        #print(7)
        print(x1,y2)
        continue
    elif (xr-x2)**2 + (yr-y1)**2 <= r*r:
        #print(8)
        print(x2,y1)
        continue
    elif (xr-x2)**2 + (yr-y2)**2 <= r*r:
        #print(9)
        print(x2,y2)
        continue
    print("Presek je prazen")