XIZOE


私信TA

用户名:903917066

访问量:4926

签 名:

等  级
排  名 325
经  验 5433
参赛次数 1
文章发表 25
年  龄 18
在职情况 学生
学  校
专  业

  自我简介:

解题思路:
将台球的整个运动过程沿水平和竖直两个方向分解,分别求出末横坐标M和末纵坐标N


参考代码:

#台球碰撞
from math import *
def REAL(p,q):
    if p<=q:
        return p
    else:
        return 2*q-p
while True:
    L,W,x,y,R,a,v,s=map(int,input().split())
    S=v*s
    m=L-2*R
    n=W-2*R
    X=S*fabs(cos(a/180*pi))
    Y=S*fabs(sin(a/180*pi))
    if S==0:
        break
    elif a<=180:
        if a<=90:
            if X<=L-x:
                M=X+x
                if Y<=W-y:
                    N=Y+y
                else:
                    N=W-R-REAL((Y+y-W+R)%(n*2),n)
            else:
                M=L-R-REAL((X+x-L+R)%(2*m),m)
                if Y<=W-y:
                    N=Y+y
                else:
                    N=W-R-REAL((Y+y-W+R)%(n*2),n)
        else:
            if X<=x-R:
                M=x-X
                if Y<=W-y:
                    N=Y+y
                else:
                    N=W-R-REAL((Y+y-W+R)%(n*2),n)
            else:
                M=REAL((X+R-x)%(2*m),m)+R
                if Y=270:
            if X<=L-x:
                M=X+x
                if Y<=y-R:
                    N=y-Y
                else:
                    N=REAL((Y+R-y)%(2*n),n)+R
            else:
                M=L-R-REAL((X+x-L+R)%(2*m),m)
                if Y<=y-R:
                    N=y-Y
                else:
                    N=REAL((Y+R-y)%(2*n),n)+R
        else:
            if X<=x-R:
                M=x-X
                if Y<=y-R:
                    N=y-Y
                else:
                    N=REAL((Y+R-y)%(2*n),n)+R
            else:
                M=REAL((X+R-x)%(2*m),m)+R
                if Y<=y-R:
                    N=y-Y
                else:
                    N=REAL((Y+R-y)%(2*n),n)+R
   
    print("{:.2f} {:.2f}".format(M,N))


 

0.0分

1 人评分

  评论区

  • «
  • »