hdoj geometry 5605 (简单数学规律)
2016-01-02 22:04
337 查看
geometry
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 59 Accepted Submission(s): 45
[align=left]Problem Description[/align]
There is a point P
at coordinate (x,y).
A line goes through the point, and intersects with the postive part of
X,Y
axes at point A,B.
Please calculate the minimum possible value of |PA|∗|PB|.
[align=left]Input[/align]
the first line contains a positive integer T,means the numbers of the test cases.
the next T lines there are two positive integers X,Y,means the coordinates of P.
T=500,0<X,Y≤10000.
[align=left]Output[/align]
T lines,each line contains a number,means the answer to each test case.
[align=left]Sample Input[/align]
1
2 1
[align=left]Sample Output[/align]
4
in the sample $P(2,1)$,we make the line $y=-x+3$,which intersects the positive axis of $X,Y$ at (3,0),(0,3).$|PA|=\sqrt{2},|PB|=2\sqrt{2},|PA|*|PB|=4$,the answer is checked to be the best answer.
[align=left]Source[/align]
BestCoder Round #68 (div.2)
#include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> using namespace std; int main() { int t,x,y,b; double s,xx,yy; scanf("%d",&t); while(t--) { scanf("%d%d",&x,&y); b=x+y; xx=sqrt((x*x)+(b-y)*(b-y)); yy=sqrt((y*y)+(b-x)*(b-x)); s=xx*yy; printf("%.0lf\n",s); } }
相关文章推荐
- HDU 1083.Courses【二分匹配】【1月2】
- setObject()用法
- 关于service的一点学习笔记
- Centos如何使用SSH远程连接主机
- [转载]UML类图总结
- ClassLoader详解及用途
- C#位运算
- NSURLConection相关知识
- 五.OC基础--1.多态,2.类对象,3.点语法,4.@property&@synthesize,5.动态类型,内省(判断对象是否遵循特定的协议,以及是否可以响应特定的消息)
- 使用onekey-decompile-apk遇到could not decode arsc file的解决办法
- IRC FreeNode Registeration
- 2016/1/2 Python中的多线程(1):线程初探
- 8皇后以及N皇后算法探究,回溯算法的JAVA实现,非递归,循环控制及其优化
- 关于C中extern的说明
- 2016CES电子展前瞻:这六大看点不容错过
- 【CSS+DIV】(3)——网上购物网站
- 二零一五,外面的世界很精彩
- Stop Hardcoding- Follow Parameterization Technique
- ios多线程
- vijos p1523 贪吃的九头龙 思考思考再思考,就荒废了4小时