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. jQuery 源码分析和使用心得 - 文档遍历 ( traversing.js )

    jQuery之所以这么好用, 首先一点就是$()方法和它强大的选择器. 其中选择器使用的是sizzle引擎, sizzle是jQuery的子项目, 提供高效的选择器查询. 有个好消息告诉大家, 就是s ...

  2. php随笔1-php图片处理

    php图片处理的知识内容 upload_image.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN ...

  3. Oracle EBS-SQL (SYS-19):sys-用户登陆纪录查询.sql

    select *  from fnd_user t  where t.user_name='user_name'

  4. DMVsinSQLServer -- 备

    /*************************************************************************************************** ...

  5. Delphi中TWebBrowser中注入Js

    最近帮朋友做一个软件,其中要自动化某网页中的操作,最简的操作是调用自己写的代码. 代码如下: procedure TForm1.Button2Click(Sender: TObject);var  i ...

  6. Objective-C基础笔记(2)@property和@synthesize

    先贴出使用@property和@synthesize实现的上一篇中的代码,再解释这两个keyword的使用方法和含义,代码例如以下: Person.h文件 #import <Foundation ...

  7. SET ANSI_NULLS (Transact-SQL)

    指定在 SQL Server 2014 中与 Null 值一起使用等于 (=) 和不等于 (<>) 比较运算符时采用符合 ISO 标准的行为. 当 SET ANSI_NULLS 为 ON ...

  8. 使用astyle格式化代码【脚本】

    astyle使用基础教程 http://cppblog.com/jokes000/articles/158838.html steps: (1) apt-get install astyle 或者去主 ...

  9. BZOJ 1832: [AHOI2008]聚会( LCA )

    LCA模板题...不难发现一定是在某2个人的LCA处集合是最优的, 然后就3个LCA取个最小值就OK了. 距离就用深度去减一减就可以了. 时间复杂度O(N+MlogN) (树链剖分) -------- ...

  10. TCP的流量控制

    TCP协议作为一个可靠的面向字节流的传输协议,其可靠性和流量控制由滑动窗口协议保证,而拥塞控制则由控制窗口结合一系列的控制算法实现. 要区分TCP的流量控制和拥塞控制: 流量控制是发送方的发送数据的速 ...