CodeForces 723A The New Year: Meeting Friends (水题)
题意:给定 3 个数,求其中一个数到另外两个数之间的最短距离。
析:很明显选中间那个点了。
代码如下:
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
//#include <tr1/unordered_map>
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std;
//using namespace std :: tr1; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const LL LNF = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e2 + 5;
const LL mod = 10000000000007;
const int N = 1e6 + 5;
const int dr[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
const char *Hex[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
inline LL gcd(LL a, LL b){ return b == 0 ? a : gcd(b, a%b); }
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int Min(int a, int b){ return a < b ? a : b; }
inline int Max(int a, int b){ return a > b ? a : b; }
inline LL Min(LL a, LL b){ return a < b ? a : b; }
inline LL Max(LL a, LL b){ return a > b ? a : b; }
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
}
int a[5]; int main(){
while(scanf("%d %d %d", a, a+1, a+2) == 3){
sort(a, a+3);
int ans = a[2] - a[0];
printf("%d\n", ans);
}
return 0;
}
CodeForces 723A The New Year: Meeting Friends (水题)的更多相关文章
- codeforces 723A : The New Year: Meeting Friends
Description There are three friend living on the straight line Ox in Lineland. The first friend live ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- Codeforces Round #185 (Div. 2) B. Archer 水题
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...
- Educational Codeforces Round 14 A. Fashion in Berland 水题
A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...
- Codeforces Round #360 (Div. 2) A. Opponents 水题
A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...
- Codeforces Round #190 (Div. 2) 水果俩水题
后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...
- Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告
对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...
- Codeforces Round #375 (Div. 2) A. The New Year: Meeting Friends 水题
A. The New Year: Meeting Friends 题目连接: http://codeforces.com/contest/723/problem/A Description There ...
- Codeforces 777D:Cloud of Hashtags(水题)
http://codeforces.com/problemset/problem/777/D 题意:给出n道字符串,删除最少的字符使得s[i] <= s[i+1]. 思路:感觉比C水好多啊,大概 ...
随机推荐
- ES6__class 的继承等相关知识案例
/** * class 的继承等相关知识 */ // extends. static. super const canvas = document.querySelector('#canvas'); ...
- UVAlive 3026 KMP 最小循环节
KMP算法: 一:next数组:next[i]就是前面长度为i的字符串前缀和后缀相等的最大长度,也即索引为i的字符失配时的前缀函数. 二:KMP模板 /* pku3461(Oulipo), hdu17 ...
- hihocoder 1165 : 益智游戏
时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 幽香今天心情不错,正在和花田里的虫子玩一个益智游戏.这个游戏是这样的,对于一个数组A,幽香从A中选择一个数a,虫子从A中选 ...
- Spring Boot+Profile实现不同环境读取不同配置
文件结构如下: 但是官方推荐放在config文件夹下. 作用: 不同环境的配置设置一个配置文件,例如:dev环境下的配置配置在application-dev.properties中.prod环境下的配 ...
- Linux后台运行命令nohub输出pid到文件(转)
用nohup可以启动一个后台进程.让一个占用前台的程序在后台运行,并静默输出日志到文件: nohup command > logfile.txt & 但是如果需要结束这个进程,一般做法是 ...
- Java时间戳转化为今天、昨天、明天(字符串格式)
原文:http://www.open-open.com/code/view/1435301895825 时间戳,相信大家一定都不陌生,服务器经常会传回来时间戳,需要我们对时间戳进行处理.各种麻烦不断, ...
- [转] Scalers:刻意练习的本质就是持续行动+刻意学习
原文: http://www.scalerstalk.com/1264-peak-conscious ------------------------------------------------- ...
- 切勿创建包括auto_ptr的容器对象
当你拷贝一个auto_ptr时,它所指向的对象的全部权被移交到拷入的auto_ptr上,而它自身被置为NULL.我的理解是:拷贝一个auto_ptr意味着改变它的值.比如: auto_ptr&l ...
- 记一次Tomcat无法正常启动的查错与解决之路
使用LombozEclipse运行某Web应用,结果总是404. 换另一个Eclipse运行,还是404. 换Tomcat到更高版本,还是404. 直接启动Tomcat,闪退. 用重定向拦截输出,可惜 ...
- HDU 4277 USACO ORZ(暴力+双向枚举)
USACO ORZ Time Limit: 5000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...