HDOJ 5605 geometry
来源:互联网 发布:您的java版本不安全 编辑:程序博客网 时间:2024/06/06 13:04
geometry
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 65 Accepted Submission(s): 49
Problem Description
There is a point P at coordinate (x,y) .
A line goes through the point, and intersects with the postive part ofX,Y axes at point A,B .
Please calculate the minimum possible value of|PA|∗|PB| .
A line goes through the point, and intersects with the postive part of
Please calculate the minimum possible value of
Input
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 .
the next T lines there are two positive integers X,Y,means the coordinates of P.
Output
T lines,each line contains a number,means the answer to each test case.
Sample Input
12 1
Sample Output
4in 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.
题意:直接给中文题面链接吧:点击打开链接
题解:我是凭直觉判断出k=1时是正解的,化了两组数,就直接写了。
贴出BC上给的证明吧:
只用计算2*x*y就行了,我写的啰嗦,代码如下:
#include<cstdio>#include<cstring>#include<cmath>int main(){int x,y,b,t,x1,x2,y1,y2;scanf("%d",&t);while(t--){scanf("%d%d",&x,&y);b=y-x;y2=b; x2=0;y1=0; x1=-b;double ans=sqrt((x1-x)*(x1-x)*1.0+(y1-y)*(y1-y)*1.0)*sqrt((x2-x)*(x2-x)*1.0+(y2-y)*(y2-y)*1.0); printf("%.0f\n",ans); }return 0;}
0 0
- HDOJ 5605 geometry
- HDOJ 5605-geometry【数学】
- hdoj-5605-geometry
- hdoj geometry 5605 (简单数学规律)
- HDOJ 5298 Solid Geometry Homework
- hdoj 4932 Miaomiao's Geometry 【暴力枚举】
- HDU 5605 geometry
- HDU 5605 geometry
- 杭电5605 geometry
- HDU 5605 geometry
- HDU 5605 geometry
- geometry
- geometry
- geometry
- Geometry
- HDOJ 1086 You can Solve a Geometry Problem too
- hdu/hdoj 1086 You can Solve a Geometry Problem too
- HDOJ HDU 1086 You can Solve a Geometry Problem too
- Linux系统启动流程
- 【Android】《第一行代码—Android》第五章总结
- 二、学习笔记之opencv创建Trackbar & 图像对比度、亮度值调整
- Shodan完全手册部分翻译(1)
- LVS之NAT模式配置
- HDOJ 5605 geometry
- c++中的类型转换函数定义
- 不太满意的第二次实验:安装Hbase
- linux开机启动详细流程
- 功能测试机设计--硬件--电流采样
- android 属性动画监听
- neutron VLAN provider network 简要分析和实验
- python之Merge Intervals
- hdoj function 5608 (数学)