B. Text Document Analysis 题目连接: http://codeforces.com/contest/723/problem/B Description Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of cha…
A. The New Year: Meeting Friends time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, t…
A. The New Year: Meeting Friends 水 #include <set> #include <map> #include <stack> #include <queue> #include <cstdio> #include <vector> #include <cstring> #include <iostream> #include <algorithm> using…
A - The New Year: Meeting Friends 水 #include<iostream> #include<algorithm> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; cout<<max(a,max(b,c)) - min(a,min(b,c)) <<endl; ; } B - Text Document Analysis…
Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bough…
题目链接:http://codeforces.com/contest/723/problem/D 题意:给定n*m小大的字符矩阵.'*'表示陆地,'.'表示水域.然后湖的定义是:如果水域完全被陆地包围则称为湖. 海的定义:如果水域与任何一个边界的水域有连通则陈伟海.现在要求填一些湖使得最后湖的数量恰好等于K.输出最小要填多少个单位的'.'水域和最终填完之后的字符矩阵. 思路:水题.注意本题的连通是四个方向[上下左右],然后dfs每一个连通块,对于每个连通块我们维护2个值:水域的数目和连通块属于海…
题目链接:http://codeforces.com/contest/723/problem/C 题意:给定长度为n的一个序列.还有一个m.现在可以改变序列的一些数.使得序列里面数字[1,m]出现次数最小的次数尽可能大.输出出现次数最小的次数.需要改变序列多少次.改变后的序列. 思路:题意有点难懂.可以发现出现次数最小的次数最大一定是(n/m).所以枚举数字[1,m]如果数字i(1<=i<=m)出现次数小于n/m,则要把序列某个数替换成i,怎么选择用哪些数来替换.应该选序列值大于m的或者序列值…
题目链接:http://codeforces.com/contest/723/problem/B 题意:给定一个字符串.只包含_,大小写字母,左右括号(保证不会出现括号里面套括号的情况),_分隔开单词.现在要你输出括号外面的单词的最大长度和括号里面出现的单词数目 思路:按照题目模拟就好了.写的比较搓. #define _CRT_SECURE_NO_DEPRECATE #include<stdio.h> #include<string.h> #include<cstring&g…
题目链接:http://codeforces.com/contest/723/problem/A 题意:在一维坐标下有3个人(坐标点).他们想选一个点使得他们3个到这个点的距离之和最小. 思路:水题.显然对这3个坐标点排序.则选的点一定是中间那个点最优. #define _CRT_SECURE_NO_DEPRECATE #include<stdio.h> #include<string.h> #include<cstring> #include<algorithm…
F. st-Spanning Tree 题目连接: http://codeforces.com/contest/723/problem/F Description You are given an undirected connected graph consisting of n vertices and m edges. There are no loops and no multiple edges in the graph. You are also given two distinct…