Codeforces 15B Laser
题目链接:点击打开链接
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<set>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define N 5005
#define ll __int64
inline ll Abs(ll x){return x>0?x:-x;}
int main(){
ll i, j, T;cin>>T;
while(T--){
ll x1,y1,x2,y2,n,m;
scanf("%I64d %I64d %I64d %I64d %I64d %I64d",&n,&m,&x1,&y1,&x2,&y2);
ll minn = min(x1,x2), maxx = max(x1,x2);
x1 = minn, x2 = maxx;
x2 -= x1-1;
x1 = 1;
minn = min(y1,y2), maxx = max(y1,y2);
y1 = minn, y2 = maxx;
y2 -= y1-1;
y1 = 1;
if(x1==x2 || y1==y2) {
if(y1==y2) {
swap(n,m); swap(x1,y1); swap(x2,y2);
}
ll cha1 = y2-y1-1, cha2 = m - y2;
cha1 -= cha2;
cha1 = max(cha1, 0ll);
printf("%I64d\n",n*cha1);
}
else {
ll x3 = x1+(n-x2), y3 = y1+(m-y2);;
if(x3>=(x2-1) && y3>=(y2-1))
printf("%I64d\n", (x2-x1)*(y2-y1)*2);
else
printf("%I64d\n",n*m-(x3-x1+1)*(y3-y1+1)*2);
}
}
return 0;
}
Codeforces 15B Laser的更多相关文章
- [Codeforces Round472C] Three-level Laser
[题目链接] https://codeforces.com/contest/957/problem/C [算法] 二分 注意精度问题 时间复杂度 :O(NlogN) [代码] #include< ...
- codeforces 957 C Three-level Laser
题意: 说的是一个电子云的三种状态,但是这不重要. 简单来说,就是在一个升序的序列中找三个数x,y,z,x和z的值之差不超过u,然后使得(z – y) / (z – x)最大. 思路: 使得(z – ...
- codeforces 724
题目链接: http://codeforces.com/contest/724 A. Checking the Calendar time limit per test 1 second memory ...
- [codeforces 241]C. Mirror Box
[codeforces 241]C. Mirror Box 试题描述 Mirror Box is a name of a popular game in the Iranian National Am ...
- Codeforces Gym 100187K K. Perpetuum Mobile 构造
K. Perpetuum Mobile Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/pro ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
随机推荐
- 1.document.write(""); 输出语句
1.document.write(""); 输出语句 2.JS中的注释为// 3.传统的HTML文档顺序是:document->html->(head,body) 4. ...
- IS about 64bit system
This function supports the 64-bit parts of the registry by using the REGDB_OPTION_WOW64_64KEY option ...
- phpcms v9指定栏目调用系列教程
调用指定栏目名称: {$CATEGORYS[栏目ID]['catname']} 调用指定栏目url {$CATEGORYS[栏目ID]['url']} 调用指定栏目栏目图片 {$CATEGORYS[栏 ...
- 【python】二进制、八进制、十六进制表示方法(3.0以上)
2进制是以0b开头的: 例如: 0b11 则表示十进制的3 8进制是以0o开头的: 例如: 0o11则表示十进制的9 (与2.0版本有区别) 16进制是以0x开头的: 例如: 0x11则表示十进制的1 ...
- python中的函数的参数和可变参数
最近在搞python的过程中需要用到给函数传可变参数..所以去网上找前人的帖子学习了一下 为了尊重原作者,这里附上链接:http://www.cnblogs.com/tqsummer/archive/ ...
- 【C语言】中的版本规范(C89 C99等)
C语言中的版本 一.相关基础知识 ISO:国际标准化组织(International Organization for Standardization,ISO)简称ISO,是一个全球性的非政府组织,是 ...
- 【UVA10537】The Toll! Revisited (逆推最短路)
题目: Sample Input1a Z19 a Z5A DD XA bb cc X39 A X-1Sample OutputCase 1:20a-ZCase 2:44A-b-c-X 题意: 有两种节 ...
- 李洪强iOS开发之-环信01_iOS SDK 前的准备工作
李洪强iOS开发之-环信01_iOS SDK 前的准备工作 1.1_注册环信开发者账号并创建后台应用 详细步骤: 注册并创建应用 注册环信开发者账号 第 1 步:在环信官网上点击“即时通讯云”,并点 ...
- Keil C51调试程序时, 对ROM的查看以及RAM 查看或修改
在Keil 里使用 DeBug 模式时,如要 查看外部 RAM 的数据 或查看 ACC 的内容可以进行以下操作; sysGetTxMode: LCALL Com0185(C:2B95) ,sysGet ...
- CAD文件导入AD09
1.首先将CAD图纸倒出为DXF格式的文件. 2.在altium designer 的pcb编辑中点菜单文件--导入,在弹出的对话框中,选择导入文件的类型,选择 DWG,DXF类型.然后确定,再弹出的 ...