Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) A Math Problem
//只要从所有区间右端点的最小值覆盖到所有区间左端点的最大值即可
#include<iostream>
using namespace std ;
int x,y;
int n;
int t;
int main() {
cin>>t;
while(t--) {
cin>>n;
if(n==) {
cin>>x>>y;
cout<<<<endl;
} else {
int l=,r=1e9+;
for(int i=; i<=n; i++) {
cin>>x>>y;
l=max(l,x);
r=min(r,y);
}
int ans=max(,l-r);
cout<<ans<<endl;
}
}
return ;
}
Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) A Math Problem的更多相关文章
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3
A,有多个线段,求一条最短的线段长度,能过覆盖到所又线段,例如(2,4)和(5,6) 那么我们需要4 5连起来,长度为1,例如(2,10)(3,11),用(3,10) 思路:我们想一下如果题目说的是最 ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) F2. Wrong Answer on test 233 (Hard Version) dp 数学
F2. Wrong Answer on test 233 (Hard Version) Your program fails again. This time it gets "Wrong ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) E. Arson In Berland Forest 二分 前缀和
E. Arson In Berland Forest The Berland Forest can be represented as an infinite cell plane. Every ce ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) D2. Optimal Subsequences (Hard Version) 数据结构 贪心
D2. Optimal Subsequences (Hard Version) This is the harder version of the problem. In this version, ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) C. Messy 构造
C. Messy You are fed up with your messy room, so you decided to clean it up. Your room is a bracket ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) B. Box 贪心
B. Box Permutation p is a sequence of integers p=[p1,p2,-,pn], consisting of n distinct (unique) pos ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) A. Math Problem 水题
A. Math Problem Your math teacher gave you the following problem: There are n segments on the x-axis ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) C Messy
//因为可以反转n次 所以可以得到任何可以构成的序列 #include<iostream> #include<string> #include<vector> us ...
- Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3) B Box
#include<bits/stdc++.h> using namespace std; ]; ]; int main() { int total; cin>>total; w ...
随机推荐
- 小白的linux笔记8:linux自动运行爬虫并发送提醒邮件
有了成功运行的爬虫后,希望能每天定时运行,且遇到错误时能及时发出提醒. 发出提醒 可以用mailx发出邮件做提醒.没有的话先安装Yum install mailx. 以qq邮箱为例,需要设置/etc/ ...
- 如何在Mac电脑上隐藏视频文件?
我们都有一些秘密视频,我们只想保留在Mac,iPhone或iPad上.为了完全安全地在Mac上隐藏视频文件,我们提供了两种种最简单的方法.下面就来看一下,如何在Mac上隐藏私密视频文件? 在iTune ...
- Win10的Cortana小娜反应慢?试试这个方法
https://www.ithome.com/html/win10/158466.htm Win10语音助手Cortana小娜可以为用户提供全面的搜索服务,不管是本地还是在线,都可以轻松找到结果.不过 ...
- Python 变量&列表 初学者笔记
变量 消除空白后该变量需要存储一下(此操作常用于“储存用户输入并对其进行清理”) strip()消除两端空白 lstrip()消除前部空白 rstrip()消除末尾空白 upper()全部字母大写 ...
- Python之pptx实现添加内容与删除(移动)页操作
问题背景 大量表格数据需要生成指定格式的ppt文件,内容以文字和表格为主,首尾页与内容有固定格式.博主不熟悉VBA操作,希望通过模板用Python完成自动化. 基本思路 使用xlrd模块读取xlsx文 ...
- HDU1163 - Eddy's digital Roots
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1163 九余数:一个数除于9所得到的余数,即模9得到的值 求九余数: 求出一个数的各位数字之和,如果是两 ...
- thinkphp5.0将数据指模板中
在控制器中写: public function index(){ $username = \think\Db::table('navigation')->where(array("Vi ...
- kali linux中mariadb加上密码
kali自带mysql.2019.4 中带得是:MariaDB.据说跟Mysql差不多.简单用了一下发现root用户可以不要密码进入Mysql! 这极不习惯,不输入密码感觉好像少了点什么.这肯定是权限 ...
- jmeter测试出现端口占用
原文地址:https://www.cnblogs.com/deepSleeping/p/12067654.html Jmeter测试会出现端口占用情况 这边在这里做个记录,每次都要百度查询,刚好需要整 ...
- H5_0013:CSS特色样式集
按比例变化,同时又限制最大宽高 ".start-wrap {", " width:40%;", " top: 83.21%;", " ...