2017 ACMICPC Asia Regional Qingdao Online 1001 Apple
来源:互联网 发布:虚拟拍照软件 编辑:程序博客网 时间:2024/05/18 13:09
Time Limit: 1000/1000 MS(Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
Problem Description
Apple is Taotao's favouritefruit. In his backyard, there are three apple trees with coordinates (x1,y1), (x2,y2), and (x3,y3). Now Taotao is planning toplant a new one, but he is not willing to take these trees too close. Hebelieves that the new apple tree should be outside the circle which the threeapple trees that already exist is on. Taotao picked a potential position (x,y) of the new tree. Couldyou tell him if it is outside the circle or not?
Input
The first line contains aninteger T, indicating that there are T(T≤30) cases.
In the first line of each case, there are eight integers x1,y1,x2,y2,x3,y3,x,y, as described above.
The absolute values of integers in input are less than or equal to 1,000,000,000,000.
It is guaranteed that, any three of the four positions do not lie on a straightline.
Output
For each case, output"Accepted" if the position is outside the circle, or"Rejected" if the position is on or inside the circle.
Sample Input
3
-2 0 0 -2 2 0 2 -2
-2 0 0 -2 2 0 0 2
-2 0 0 -2 2 0 1 1
Sample Output
Accepted
Rejected
Rejected
最终代码还是wa
#include <iostream>#include <cmath>#include <cstdio>using namespace std;typedef long long ll;int main(){ int T; scanf("%d",&T); while(T--) { double x1,y1,x[5],y[5]; double a,b,r; int i; for(i=1;i<=3;i++) scanf("%lf%lf",&x[i],&y[i]); scanf("%lf%lf",&x1,&y1); a = (x[2]*x[2]*y[1]-x[3]*x[3]*y[1]-x[1]*x[1]*y[2]+x[3]*x[3]*y[2]-y[1]*y[1]*y[2]+y[1]*y[2]*y[2]+x[1]*x[1]*y[3]-x[2]*x[2]*y[3]+y[1]*y[1]*y[3]-y[2]*y[2]*y[3]-y[1]*y[3]*y[3]+y[2]*y[3]*y[3])/(2* (x[2]* y[1] - x[3] *y[1] - x[1]* y[2] + x[3]* y[2] + x[1]* y[3] - x[2]* y[3])); b = -(-x[1]*x[1]* x[2] + x[1]*x[2]*x[2] + x[1]*x[1] *x[3] - x[2]*x[2]* x[3] - x[1]* x[3]*x[3] + x[2]* x[3]*x[3] - x[2] *y[1]*y[1] + x[3] *y[1]*y[1] + x[1] *y[2]*y[2] - x[3] *y[2]*y[2] - x[1]* y[3]*y[3] + x[2]* y[3]*y[3])/(2 *(x[2] *y[1] - x[3]* y[1] - x[1] *y[2] + x[3] *y[2] + x[1] *y[3] - x[2]* y[3])); r = sqrt((x[1]-a)*(x[1]-a) + (y[1]-b)*(y[1]-b)); //printf("%lf %lf %lf\n",a,b,r); double t = sqrt((x1-a)*(x1-a) + (y1-b)*(y1-b)); if(t>r) printf("Accepted\n"); else printf("Rejected\n"); } return 0;}
- 2017 ACMICPC Asia Regional Qingdao Online 1001 Apple
- 2017 ACM/ICPC Asia Regional Qingdao Online:1001 Apple
- HDU-2017 ACM/ICPC Asia Regional Qingdao Online-1001-Apple
- 2017 ACM/ICPC Asia Regional Qingdao Online 1001/HDUOJ 6206 Apple
- 2017 ACM/ICPC Asia Regional Qingdao Online:1001:Apple(几何+JAVA大数)
- 2017 ACMICPC Asia Regional Shenyang Online
- 2017 ACM/ICPC Asia Regional Qingdao Online
- 2017 ACM/ICPC Asia Regional Qingdao Online
- 2017 ACM/ICPC Asia Regional Qingdao Online
- 2017 ACM/ICPC Asia Regional Qingdao Online
- 2017 ACMICPC Asia Regional Shenyang Online 个人题解汇总
- 2017 ACM/ICPC Asia Regional Qingdao Online 1001-Apple(Java大实数类BigDecimal应用)(已知三点坐标求圆心坐标和半径)
- 2016 ACM/ICPC Asia Regional Qingdao Online 1001
- 2017 ACM/ICPC Asia Regional Qingdao Online--Chinese Zodiac
- 2017 ACM/ICPC Asia Regional Qingdao Online:1008 Chinese Zodiac
- HDu 6216 && 2017 ACM/ICPC Asia Regional Qingdao Online 1011
- 2017 ACM/ICPC Asia Regional Qingdao Online【solved:7 / 11】
- 2017 ACM/ICPC Asia Regional Qingdao Online Brute Force Sorting
- MYSQL(五)
- 表单验证...
- Java运算符
- 第二周 项目1
- iOS运行App总是提示Unknown class in Interface Builder file的解决
- 2017 ACMICPC Asia Regional Qingdao Online 1001 Apple
- 感知器在matlab中应用
- 技能架构设计
- 关于Mac上使用百度云下载速度慢的解决方案
- es5中严格模式相关问题
- HDU
- Ubuntu新手入门全攻略
- Android AsyncTask 源码解析
- C语言笔记——gets_s, fgets, puts函数