geometry

 Accepts: 324
 Submissions: 622
 Time Limit: 2000/1000 MS (Java/Others)
 Memory Limit: 65536/65536 K (Java/Others)
Problem Description

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∣.

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=500T=500,0< X,Y\leq 100000<X,Y≤10000.

Output

T lines,each line contains a number,means the answer to each test case.

Sample Input
1
2 1
Sample Output
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(简单数学题)的更多相关文章

  1. HDU 6467 简单数学题 【递推公式 && O(1)优化乘法】(广东工业大学第十四届程序设计竞赛)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6467 简单数学题 Time Limit: 4000/2000 MS (Java/Others)    M ...

  2. HDU 6467.简单数学题-数学题 (“字节跳动-文远知行杯”广东工业大学第十四届程序设计竞赛)

    简单数学题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submi ...

  3. Discrete Function(简单数学题)

    Discrete Function There is a discrete function. It is specified for integer arguments from 1 to N (2 ...

  4. JZOJ 5773. 【NOIP2008模拟】简单数学题

    5773. [NOIP2008模拟]简单数学题 (File IO): input:math.in output:math.out Time Limits: 1000 ms  Memory Limits ...

  5. [JZOJ5773]【NOIP2008模拟】简单数学题

    Description       话说, 小X是个数学大佬,他喜欢做数学题.有一天,小X想考一考小Y.他问了小Y一道数学题.题目如下:      对于一个正整数N,存在一个正整数T(0<T&l ...

  6. NEFU 117 - 素数个数的位数 - [简单数学题]

    题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=117 Time Limit:1000ms Memory Limi ...

  7. HDU-5310-Souvenir(C++ &amp;&amp; 简单数学题)

    Souvenir Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total ...

  8. codeforces 340C Tourist Problem(简单数学题)

    题意:固定起点是0,给出一个序列表示n个点,所有点都在一条直线上,其中每个元素代表了从起点到这个点所走的距离.已知路过某个点不算到达这个点,则从起点出发,到达所有点的方案有许多种.求所有方案走的总路程 ...

  9. 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 ...

随机推荐

  1. Ajax中XML和JSON格式的优劣比较

    刚做完一个小的使用Ajax的项目.整个小项目使用JavaScript做客户端,使用PHP做服务器端.利用xmlHttpRequest组件作为交互工具,利用XML作为数据传输的格式.做完后基本做一个简单 ...

  2. php多维数组按用户自定义顺序排序uasort()

    多维数组如果需要按照某个字段值进行排序,可以尝试array_multisort().但有一个前提,这个字段值的排序是要一定规律的,如字符升序a-z,或者数字降序等等. 现有多维数组如下: $arr = ...

  3. Oracle EBS-SQL (BOM-6):检查物料失效但BOM中未失效的数据.sql

    select msi.segment1                   装配件编码 , msi.description                  装配件描述 , msi.item_type ...

  4. Open source and free log analysis and log management tools.

    Open source and free log analysis and log management tools. Maintained by Dr. Anton Chuvakin Version ...

  5. JavaEE Tutorials (18) - Java EE平台安全介绍

    18.1Java EE安全概述278 18.1.1简单的应用安全演示279 18.1.2安全机制特性281 18.1.3应用安全特点28118.2安全机制282 18.2.1Java SE安全机制28 ...

  6. 继承ViewGroup研究(汇总) 一、二、三

    转载过来:为一.二.三版本. 仅供参考: 继承ViewGroup研究(1) --简介和一个小Demo 又翻开一个新篇章了,哈哈,上一回学习的是继承View,关于继承View个人感觉不是那么完美,做技术 ...

  7. 如何让多个不同版本的jquery库共存

    问题描述:公司的登录接口使用的是jquery1.4.2,因为我要使用一个jquery.pagination的分页控件(jquery1.7.2).如果我使用了1.7.2,登录接口会有问题. <sc ...

  8. 写个脚本列出neutron的ovs的topology。

    运行结果如下: $ ./nova-ifinfo  a7026868-407c-4c54-bb8f-a68623d7e13fvm name is: instance-00000035    # 查找VM ...

  9. openNebula rgister img instance vms error collections

    1, 注册镜像报错信息 ERROR="Fri Nov 21 12:57:17 2014 : Error copying image in the datastore: Not allowed ...

  10. ceph伦理概念

    Preface: CEPH: THE FUTURE OF STORAGE(未来存储) Ceph was made possible by a global community of passionat ...