geometry(简单数学题)
geometry
There is a point PP at coordinate (x,y)(x,y). A line goes through the point, and intersects with the postive part of X,YX,Y axes at point A,BA,B. Please calculate the minimum possible value of |PA|*|PB|∣PA∣∗∣PB∣.
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=500T=500,0< X,Y\leq 100000<X,Y≤10000.
T lines,each line contains a number,means the answer to each test case.
1
2 1
4 in the sample P(2,1)P(2,1),we make the line y=-x+3y=−x+3,which intersects the
positive axis of X,YX,Y at (3,0),(0,3).|PA|=\sqrt{2},|PB|=2\sqrt{2},
|PA|*|PB|=4∣PA∣=√2,∣PB∣=2√2,∣PA∣∗∣PB∣=4,the answer is checked to be the best answer.
题解:简单高中数学题,算下就可以得到2xy;
代码:
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define PI(x) printf("%d",x)
#define PL(x) printf("%lld",x)
#define P_ printf(" ")
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
int main(){
int T,x,y;
SI(T);
while(T--){
SI(x);SI(y);
printf("%d\n",2*x*y);
}
return 0;
}
geometry(简单数学题)的更多相关文章
- HDU 6467 简单数学题 【递推公式 && O(1)优化乘法】(广东工业大学第十四届程序设计竞赛)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6467 简单数学题 Time Limit: 4000/2000 MS (Java/Others) M ...
- HDU 6467.简单数学题-数学题 (“字节跳动-文远知行杯”广东工业大学第十四届程序设计竞赛)
简单数学题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submi ...
- Discrete Function(简单数学题)
Discrete Function There is a discrete function. It is specified for integer arguments from 1 to N (2 ...
- JZOJ 5773. 【NOIP2008模拟】简单数学题
5773. [NOIP2008模拟]简单数学题 (File IO): input:math.in output:math.out Time Limits: 1000 ms Memory Limits ...
- [JZOJ5773]【NOIP2008模拟】简单数学题
Description 话说, 小X是个数学大佬,他喜欢做数学题.有一天,小X想考一考小Y.他问了小Y一道数学题.题目如下: 对于一个正整数N,存在一个正整数T(0<T&l ...
- NEFU 117 - 素数个数的位数 - [简单数学题]
题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=117 Time Limit:1000ms Memory Limi ...
- HDU-5310-Souvenir(C++ && 简单数学题)
Souvenir Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total ...
- codeforces 340C Tourist Problem(简单数学题)
题意:固定起点是0,给出一个序列表示n个点,所有点都在一条直线上,其中每个元素代表了从起点到这个点所走的距离.已知路过某个点不算到达这个点,则从起点出发,到达所有点的方案有许多种.求所有方案走的总路程 ...
- uva 10161 Ant on a Chessboard 蛇形矩阵 简单数学题
题目给出如下表的一个矩阵: (红字表示行数或列数) 25 24 23 22 21 5 10 11 12 13 20 9 8 7 14 19 3 2 3 6 15 18 2 1 4 5 16 17 1 ...
随机推荐
- python初学笔记(二)
注释: 任何时候,我们都可以给程序加上注释.注释是用来说明代码的,给自己或别人看,而程序运行的时候,Python解释器会直接忽略掉注释,所以,有没有注释不影响程序的执行结果,但是影响到别人能不能看懂你 ...
- 供应类型与计划分类一致性检查(INV)
应用 Oracle Inventory 层 Level Function 函数名 Funcgtion Name CUXINVIMM 表单名 Form Name CUXINVIMM 说明 Descrip ...
- C语言入门(4)——常量、变量与赋值
对于基本数据类型量,按其取值是否可改变又分为常量和变量两种.在程序执行过程中,其值不发生改变的量称为常量,其值可变的量称为变量.它们可与数据类型结合起来分类. 常量 常量有字符常量(Character ...
- 强烈推荐visual c++ 2012入门经典适合初学者入门
强烈推荐visual c++ 2012入门经典适合初学者入门 此书循序渐进,用其独特.易于理解的教程风格来介绍各个主题,无论是编程新手,还是经验丰富的编程人员,都很容易理解. 此书的目录基本覆盖了Wi ...
- 20140613_JavaWeb学习之开发环境配置篇
本文所使用软件百度云盘网址:http://pan.baidu.com/s/1kTDRFwz 1安装JDK 操作系统:windows7-64bit 版本号:jdk-7u51-windows-x64 安装 ...
- UVA 12075 - Counting Triangles(容斥原理计数)
题目链接:12075 - Counting Triangles 题意:求n * m矩形内,最多能组成几个三角形 这题和UVA 1393类似,把总情况扣去三点共线情况,那么问题转化为求三点共线的情况,对 ...
- Excel表格中汉字转拼音
一.使用“实用汉字转拼音V4.8” 软件 下载地址http://www.orsoon.com/soft/4413.html 或则百度 很多的 二.Excel自定义函数方法: 1.启动Excel 200 ...
- c# 小数的处理
数值类型处理小数 1.Math.Round(x) 四舍五入 Math.Round(0.4) 0 Math.Round(-1.7) -2 2.Math.floor(x) 小于等于 x, ...
- 防止自己的网站被别人frame引用造成钓鱼
自己负责的某一网站,最近被不法份子通过<frame>的方式引入,用户点击对方的域名后,看到的内容跟自己网站一模一样.但是右击查看源码就会发现其中的原理: <!DOCTYPE HTML ...
- TOJ 1702.A Knight's Journey
2015-06-05 问题简述: 有一个 p*q 的棋盘,一个骑士(就是中国象棋里的马)想要走完所有的格子,棋盘横向是 A...Z(其中A开始 p 个),纵向是 1...q. 原题链接:http:// ...