2021中国大学生程序设计竞赛(CCPC)- 网络选拔赛(重赛)1002

Kanade Doesn't Want to Learn CG

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 1786    Accepted Submission(s): 374


 

Problem Description
Computational geometry and computer graphics are such hard parts of computer science that Kanade can't manage them. So she doesn't want to learn CG anymore. She goes to play basketball instead.

The only essential equipment in a basketball game is the ball and the hoop — a flat, rectangular backboard with a basket. We describe the hoop with a side view. Ignoring the thickness, the backboard is considered as a segment parallel to the y-axis, and the basket is considered as a segment parallel to the x-axis. The right end of the basket is connected to the backboard.

To simplify the model, we consider a basketball as a mass point. Taking only gravity into consideration, if we ignore the basket and the backboard, the trajectory of basketball will be a parabola y=ax2+bx+c with a<0. But the basketball is likely to hit the backboard, resulting in a change in trajectory. We consider the collision between a basketball and the backboard (including the endpoints) as a perfectly elastic collision, which means the velocity on the x-axis of the basketball will be reversed, and the velocity on the y-axis will remain the same. We ignore the court floor in this problem.

If the basketball passes through the basket (excluding the endpoints) from top to bottom, we consider the shoot is a goal. Once the basketball touches either of the endpoints of the basket, which means it hits the rim, the basketball will be bounced away and cannot make a goal. In addition, according to the rule, a basketball cannot pass through the basket from bottom to top, or it is a violation and cannot be counted as a goal.

Kanade knows the value of a,b,c and the position of the backboard and basket. She would like to know whether the shoot will be a goal if the basketball starts from x=−1145141919810 and moves in the positive direction of the x-axis. 
 

Input
The first line of input contains one integer T (1≤T≤500), indicating the number of test cases.

For each test case, the first line contains three integers a,b,c (a<0), indicating the parameters of the parabola.

The second line of each test case contains five integers x0,x1,y0,y1,y2 (x0<x1,y1<y0<y2), indicating that the two endpoints of the basket are (x0,y0) and (x1,y0), and the two endpoints of the backboard are (x1,y1) and (x1,y2).

It is guaranteed that the absolute value of all integers in the input won't exceed 104. 
 

Output
For each test case, if the shoot is a goal, output 𝚈𝚎𝚜 in a single line, otherwise output 𝙽𝚘 in a single line.
 

Sample Input
 
 
4 -1 4 5 3 5 6 5 8 -2 -3 3 -1 0 2 1 4 -1 -9 19 8 10 6 5 8 -1 9 19 8 10 4 3 6
 

Sample Output
 
 
Yes Yes No No
 

Hint
The samples are shown as follows. Segment AB represents the basket, and segment CD represents the backboard.

int a,b,c;
int X0,X1,Y0,Y1,Y2;
double f(int x,int a,int b,int c){
    return a*x*x+b*x+c;;
}
int main(){
    int t;
    cin>>t;
    while (t--) {

        cin>>a>>b>>c;
        cin>>X0>>X1>>Y0>>Y1>>Y2;
        double h1=f(X0,a,b,c);
        double h2=f(X1,a,b,c);
        double h3=f(2*X1-X0,a,b,c);
        if(h1>Y0&&h3<Y0&&h2!=Y0&&h2<=Y2) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

郭晋龙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值