QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#639078#9227. Henry the Plumberucup-team3646Compile Error//C++20942b2024-10-13 17:51:002024-10-13 17:51:01

Judging History

你现在查看的是最新测评结果

  • [2024-10-13 17:51:01]
  • 评测
  • [2024-10-13 17:51:00]
  • 提交

answer

def Dot(p,q):
  res=0
  for i in range(3):
    res+=p[i]*q[i]
  return res

def solve():
  x1,y1,z1=map(int,input().split())
  a,b=map(int,input().split())
  x2,y2,z2=map(int,input().split())
  d,e=map(int,input().split())
  det=a*e-b*d
  
  if det==0:
    if Dot((x2-x1,y2-y1,z2-z1),(a,b,0))==0:
      print(2)
    else:
      print(4)
    return
  
  if x1==x2 and y1==y2:
    print(2)
    return
  x1,y1,z1,x2,y2,z2=x1*det*2,y1*det*2,z1*det*2,x2*det*2,y2*det*2,z2*det*2

  c=a*x1+b*y1
  f=d*x2+e*y2

  Cx=(e*c-b*f)//det
  Cy=(-d*c+a*f)//det

  M1=((x1+x2)//2,(y1+y2)//2,(z1+z2)//2)
  
  R=0
  R=(x1-M1[0])**2+(y1-M1[1])**2+(z1-M1[2])**2
  
  Mx=M1[0]
  My=M1[1]
  
  d=(Cx-Mx)*(Cx-Mx)+(Cy-My)*(Cy-My)
  if d<=R:
    if z1==z2 and d==R:
      if (x1,y1)==(Cx,Cy) or (x2,y2)==(Cx,Cy):
        print(4)
        return
    print(3)
  else:
    print(4)

for _ in range(int(input())):
  solve()

详细

answer.code:1:1: error: ‘def’ does not name a type
    1 | def Dot(p,q):
      | ^~~