fork(1) download
  1. def g(p1,p2,a,b)
  2. as=[]
  3. [a,p1,p2].each{|e|
  4. as<<e.zip(b).map{|e2| e2[0]-e2[1]}
  5. }
  6. e1=as[0]
  7. e2=as[1]
  8. e3=as[2]
  9. t=e1[0]*(e2[1]*e3[2]-e3[1]*e2[2])+e1[1]*(e2[0]*e3[2]-e2[2]*e3[0])+e1[2]*(e2[0]*e3[1]-e3[0]*e2[1])
  10. return (t<=0)?0:1
  11. end
  12. def f()
  13. return gets.split(" ").map{|e| e.to_i}
  14. end
  15. a=f()
  16. b=f()
  17. cs=[]
  18. ds=[0,0]
  19. 3.times{
  20. cs<<f()
  21. }
  22. 3.times{|i|
  23. ds[g(cs[i],cs[(i+1)%3],a,b)]+=1
  24. }
  25. ans="HIT"
  26. p ds
  27. ans="MISS" if ds[0]==3
  28. puts ans
Success #stdin #stdout 0.01s 6416KB
stdin
-10 6 6
10 6 6
0 10 0
0 10 10
0 0 10
stdout
[0, 3]
HIT