Screen resolution of Polycarp’s monitor is a×b pixels. Unfortunately, there is one dead pixel at his screen. It has coordinates (x,y) (0≤x<a,0≤y<b). You can consider columns of pixels to be numbered from 0 to a−1, and rows — from 0 to b−1.

Polycarp wants to open a rectangular window of maximal size, which doesn’t contain the dead pixel. The boundaries of the window should be parallel to the sides of the screen.

Print the maximal area (in pixels) of a window that doesn’t contain the dead pixel inside itself.

Input
In the first line you are given an integer t (1≤t≤104) — the number of test cases in the test. In the next lines you are given descriptions of t test cases.

Each test case contains a single line which consists of 4 integers a,b,x and y (1≤a,b≤104; 0≤x<a; 0≤y<b) — the resolution of the screen and the coordinates of a dead pixel. It is guaranteed that a+b>2 (e.g. a=b=1 is impossible).

Output
Print t integers — the answers for each test case. Each answer should contain an integer equal to the maximal possible area (in pixels) of a rectangular window, that doesn’t contain the dead pixel.

Example
Input
6
8 8 0 0
1 10 0 3
17 31 10 4
2 1 0 0
5 10 3 9
10 10 4 8
Output
56
6
442
1
45
80
Note
In the first test case, the screen resolution is 8×8, and the upper left pixel is a dead pixel. Here you can see one of two possible layouts of the maximal window.

思路:这一个小球把这一张图分成了最多四个部分,求出最大值就可以了。
代码如下:

#include<bits/stdc++.h>
#define ll long long
using namespace std;int a,b,x,y;int main()
{int t;scanf("%d",&t);while(t--){scanf("%d%d%d%d",&a,&b,&x,&y);int s1=a*y;int s2=b*x;int s3=a*(b-y-1);int s4=b*(a-x-1);cout<<max(max(s1,s2),max(s3,s4))<<endl;}return 0;
}

努力加油a啊,(o)/~

Dead Pixel CodeForces - 1315A(思维)相关推荐

  1. isp 图像算法(二)之dead pixel correction坏点矫正

    代码在git 相机中的坏点就是那些和周围不一样的点,就是那些数值极大或者极小值点,你可以理解一张曲面的山峰或者山谷,人群中也是一样,那些与大众不一样的人就是"坏人",衡量好坏用他与 ...

  2. Codeforces Round #623 (Div. 2, based on VK Cup 2019-2020 - Elimination Round, Engine) A Dead Pixel

    讨论坏点的左右上下的矩形大小. #include <bits/stdc++.h> using namespace std; int main() {int t;cin >> t ...

  3. CodeForces 798D 思维,贪心

    CodeForces 798D 题意:长度为 n的两个数组 a[]和 b[],要找出 k ( k<=n/2+1 )个下标,使得在两个数组中这 k个数的和乘上 2 要大于所有数的和. tags: ...

  4. codeforces - 1315C - 思维题

    原题链接:https://codeforces.com/problemset/problem/1315/C 翻译: 这是一个猜谜游戏,你需要猜中一个序列,谜题是一个序列,我们设为b,长度为n.你需要根 ...

  5. Balanced Substring CodeForces - 873B (思维+前缀和)

    Balanced Substring CodeForces - 873B You are given a string s consisting only of characters 0 and 1. ...

  6. Codeforces 1093C (思维+贪心)

    题面 传送门 题目大意: 有一个长n(n为偶数)的序列a 已知a满足 \(a_1≤a_2≤⋯≤a_n\) 给出一个长度为\(\frac{n}{2}\) 的序列b,定义\(b_i=a_i+a_{n-i+ ...

  7. B. Bogosort codeforces(思维)

    outputstandard output You are given an array a1,a2,-,an. Array is good if for each pair of indexes i ...

  8. Count Subrectangles CodeForces - 1323B(思维)

    You are given an array a of length n and array b of length m both consisting of only integers 0 and ...

  9. Three Integers CodeForces - 1311D(思维+暴力)

    You are given three integers a≤b≤c. In one move, you can add +1 or −1 to any of these integers (i.e. ...

最新文章

  1. 六大主题报告,四大技术专题,AI开发者大会首日精华内容全回顾
  2. UCSC hg19.ensembl.gtf
  3. SAP QM Multiple Specifications的使用II
  4. 服务器的智能监控管理结束,通过服务器监控告警进行异常排障
  5. matlab中数值的取整、四舍五入、文本输出
  6. 小米平板5有望8月发布:骁龙870+120Hz刷新率屏
  7. Python版基于递归的冒泡排序算法
  8. sql server表分区_SQL Server 2016增强功能– SQL截断表和表分区
  9. 境外WiFi市场持续升温 2016年或迎普及元年
  10. 我们是这样写升级日志的,处处可以体现人文情怀
  11. 常用响应式web UI框架搜集整理
  12. uniapp点击复制文本
  13. 蒲丰投针实验原理_神奇的圆周率——布丰投针实验
  14. 用Python和OpenCV实现照片马赛克拼图(蒙太奇照片)
  15. 仿照苏宁易购小程序页面
  16. 数据结构c语言版第三版实验四答案,数据结构(C语言版)第三四章习题答案
  17. ROS小车基于yocs_smoother_velocity做速度平滑处理
  18. Mysql 查询数据库数据量
  19. 陶泓达:3.23黄金,原油,白银操作策略!
  20. Python编程:loguru管理日志输出

热门文章

  1. Android—Bitmap图片大小计算、压缩与三级缓存
  2. 渗透测试报告标准编写
  3. 中科院分区 2020_2020中科院期刊分区出炉!文末附2020年中科院期刊分区基础版(全)...
  4. php删除框架集,delete 删除-Medoo - 高效的轻量级PHP数据库框架, 提高开发效率!
  5. Qt::WA_TransparentForMouseEvents用法
  6. win10下安装SQLServer2000
  7. java数组随机抽取分布均匀_java利用数组随机抽取幸运观众
  8. 网易笔试编程题java_2017年网易校招笔试JAVA研发编程题
  9. 如何优雅的处理异常?SpringBoot全局异常与数据校验
  10. JS引擎、运行时与调用栈概述