2019 GDUT Rating Contest II : Problem F. Teleportation
题面:
Problem F. Teleportation
Farmer John’s farm is built along a single long straight road, so any location on his farm can be described simply using its position along this road (effectively a point on the number line). A teleporter is described by two numbers x and y, where manure brought to location x can be instantly transported to location y, or vice versa.
题目描述:
题目分析:




1 #include <cstdio>
2 #include <iostream>
3 #include <algorithm>
4 #include <cmath>
5 using namespace std;
6
7 int main(){
8 int a, b, x, y;
9 cin >> a >> b >> x >> y;
10
11 int res = 1e9; //设为"无穷大"
12 res = min(res, abs(a-b)); //第一种情况
13 res = min(res, abs(a-x)+abs(b-y)); //第二种情况
14 res = min(res, abs(a-y)+abs(b-x)); //第三种情况
15
16 cout << res << endl;
17 return 0;
18 }
2019 GDUT Rating Contest II : Problem F. Teleportation的更多相关文章
- 2019 GDUT Rating Contest II : Problem G. Snow Boots
题面: G. Snow Boots Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest II : Problem C. Rest Stops
题面: C. Rest Stops Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest II : Problem B. Hoofball
题面: 传送门 B. Hoofball Input file: standard input Output file: standard output Time limit: 5 second Memor ...
- 2019 GDUT Rating Contest III : Problem D. Lemonade Line
题面: D. Lemonade Line Input file: standard input Output file: standard output Time limit: 1 second Memo ...
- 2019 GDUT Rating Contest II : A. Taming the Herd
题面: A. Taming the Herd Input file: standard input Output file: standard output Time limit: 1 second Me ...
- 2019 GDUT Rating Contest I : Problem H. Mixing Milk
题面: H. Mixing Milk Input file: standard input Output file: standard output Time limit: 1 second Memory ...
- 2019 GDUT Rating Contest I : Problem A. The Bucket List
题面: A. The Bucket List Input file: standard input Output file: standard output Time limit: 1 second Me ...
- 2019 GDUT Rating Contest I : Problem G. Back and Forth
题面: G. Back and Forth Input file: standard input Output file: standard output Time limit: 1 second Mem ...
- 2019 GDUT Rating Contest III : Problem E. Family Tree
题面: E. Family Tree Input file: standard input Output file: standard output Time limit: 1 second Memory ...
随机推荐
- windows脚本bat编程:WIN10脚本自动启动虚拟环境中的jupyter
python编程对各种扩展包的版本依赖较严格,为了解决版本差异,通用情况下会使用virtualenv创建的虚拟环境来独立应用.那么每次使用的时候就需要启动虚拟环境,如果每次都是手工启动,每次输入几条命 ...
- 从.NET看微软的焦虑
节日没事,就像聊聊微软的NET. 1.孩子静悄悄,必定在作妖 截止目前,微软的市值达到1.85万亿美元,按说,这样一个宙斯级的巨无霸应该过的非常舒坦, 但是,和微软市值成鲜明的反差,我们从.NET的发 ...
- linux通识
linux是服务器应用领域的开源且免费的多用户多任务操作系统的内核. 以下是对上述论断的解释: 操作系统 简言之,操作系统乃是所有计算设备的大管家,小到智能手表,大到航天航空设备,所有需要操控硬件的地 ...
- CURL (CommandLine Uniform Resource Locator) 简易教程!
1 http://curl.haxx.se/ http://curl.haxx.se/docs/httpscripting.html curl is an open source command li ...
- JavaScript 注释规范
JavaScript 注释规范 总原则 As short as possible(如无必要,勿增注释).尽量提高代码本身的清晰性.可读性. As long as necessary(如有必要,尽量详尽 ...
- Publish/Subscribe Pattern & Vanilla JavaScript
Publish/Subscribe Pattern & Vanilla JavaScript https://en.wikipedia.org/wiki/Publish–subscribe_p ...
- PM2 & nodemon
PM2 & nodemon node.js server tools PM2 https://pm2.keymetrics.io/ https://pm2.io/ $ yarn global ...
- SSR & 轮询登录 & Token
SSR & 轮询登录 & Token https://yuchengkai.cn/docs/frontend 扫码登录原理 https://www.cnblogs.com/xgqfrm ...
- 比特币大涨之际,VAST空投火爆来袭!
昨天特斯拉宣布投资了15亿美元的比特币,消息一出,币圈沸腾,比特币瞬间拉升,突破4万美元关口,现价46000美元!大涨20%,又刷新历史新高! 另外NGK项目热度最高的BGV也是不断刷新历史新高,数据 ...
- 大数据开发-linux下常见问题详解
1.user ss is currently user by process 3234 问题原因:root --> ss --> root 栈递归一样 解决方式:exit 退出当前到ss再 ...