题意:给定 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 (水题)的更多相关文章

  1. codeforces 723A : The New Year: Meeting Friends

    Description There are three friend living on the straight line Ox in Lineland. The first friend live ...

  2. 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 ...

  3. 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 ...

  4. Educational Codeforces Round 14 A. Fashion in Berland 水题

    A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...

  5. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  6. Codeforces Round #190 (Div. 2) 水果俩水题

    后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...

  7. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

  8. 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 ...

  9. Codeforces 777D:Cloud of Hashtags(水题)

    http://codeforces.com/problemset/problem/777/D 题意:给出n道字符串,删除最少的字符使得s[i] <= s[i+1]. 思路:感觉比C水好多啊,大概 ...

随机推荐

  1. Java jsp页面中jstl标签详解

    JSLT标签库,是日常开发经常使用的,也是众多标签中性能最好的.把常用的内容,放在这里备份一份,随用随查.尽量做到不用查,就可以随手就可以写出来.这算是Java程序员的基本功吧,一定要扎实. JSTL ...

  2. 有向图欧拉回路个数 BEST定理

    有向图欧拉回路个数 BZOJ 3659 但是没有这道题了  直接贴一个别人的板子吧 欧拉回路:存在一条路径经过所有的边刚好1次 有向图欧拉回路存在充要条件:①图连通:②对于所有点都满足出度=入度 BE ...

  3. [洛谷U22158]策划体验(树上斜率优化)(二分最优决策)

    题目背景 OL不在,Clao又在肝少*前线,他虽然觉得这个游戏的地图很烦,但是他认为地图的难度还是太低了,习习中作为策划还不够FM,于是他自己YY了一种新的地图和新的机制: 题目描述 整个地图呈树形结 ...

  4. MongoDB学习day09--Mongoose aggregate 多表关联查询

    Mongodb的aggregate应用之前已经说过了. 可以参考day06 Mongoose的aggregate函数应用 var mongoose=require('./db.js'); var Or ...

  5. SVN 更新后Tomcat 启动时出现问题

    更新了svn后,启动本地的tomcat容器发现启动不了, 检查后发现是配置文件配置出现问题,因为我们的该项目 配置有tomcat与weblogic两种 , 而在我的web.xml中 默认配置的serv ...

  6. S5700&S5710 产品文档 : 配置

    http://support.huawei.com/hdx/hdx.do?docid=SC0000699332&lang=zh&path=PBI1-C103367%2FPBI1-C10 ...

  7. sqlite中常见的问题总结

    一.sqlite中不能使用日期进行相减,执行结果无效 例如:SELECT count(*) as cnt FROM DayBanalces WHERE (date(ofDay)- date('2013 ...

  8. jenkins的构建日志(console output)分类解析

    每个jenkins的job构建过程中会产生大量日志,如何快速找到或者查看我们关心的日志显得很有意义,为此jenkins提供了一个插件“Log Parser Plugin”可以帮助我们完成这个任务. 1 ...

  9. Use JavaScript to Export Your Data as CSV

    原文: http://halistechnology.com/2015/05/28/use-javascript-to-export-your-data-as-csv/ --------------- ...

  10. Linux中查看文件或者文件夹大小

    df -l 查看磁盘空间大小命令 df -hl  查看磁盘剩余空间 df -h  查看每个根路径的分区大小 du -sh  当前文件夹下所有文件大小(包括子文件大小 du -sm  [文件夹] 返回该 ...