E. Subordinates time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each…
题目链接 http://codeforces.com/contest/729/problem/E 题意:给你n个人,主管id为s,然后给你n个id,每个id上对应一个数字表示比这个人大的有几个. 最后问你有几个人搞错了. 一道简单的贪心题先将比自己大有i个人的存起来然后倒着贪心讲后面的补上前面不足的.当主管搞错时要特殊考虑一下 拿样例举例 (1) 3 2 2 0 2 (上司数) 0 1 (个数)     1 0 2 2 这样显然不符合因为上司为1个的没有而上司为2个的却有2个,所以一定要吧补上一…
题目链接 http://codeforces.com/contest/729/problem/D 题意:给你一个1*n的区域有a艘船,每艘船宽b,已经开了k枪都没打到,问你最少再开几枪至少能打到一艘船. 想清楚了挺简单的,只要找到所有船可能放的地方然后存下再找任意sum-a+1个位置即可. #include <iostream> #include <cstring> #include <algorithm> #include <vector> using n…
http://codeforces.com/contest/737 A: 题目大意: 有n辆车,每辆车有一个价钱ci和油箱容量vi.在x轴上,起点为0,终点为s,中途有k个加油站,坐标分别是pi,到每个加油站都可以加满油. 每辆车有2种模式,加速模式花1分钟和2个单位的油前进1个单位,正常模式花2分钟和1个单位的油前进1个单位.  要求选一辆最便宜的车,使得开这辆车从起点到终点的时间小于等于t.从起点出发的时候油是满的. n,k<=105.  vi,pi,s<=109 思路: 首先由于每次都可…
Description Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robo…
Description Santa Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each key is either on its place, or on th…
Description Santa Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom there are n lanes of m desks each, and there are two working places at each of the desks. The lanes…
D. Santa Claus and a Palindrome time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to co…
E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus has n tangerines, and the i-th of them consists of exactly ai slices. Santa Claus came to a school…
A. Road to Cinema 很明显满足二分性质的题目. 题意:某人在起点处,到终点的距离为s. 汽车租赁公司提供n中车型,每种车型有属性ci(租车费用),vi(油箱容量). 车子有两种前进方式 :①. 慢速:1km消耗1L汽油,花费2分钟. ②.快速:1km消耗2L汽油,花费1分钟. 路上有k个加油站,加油不需要花费时间,且直接给油箱加满. 问在t分钟内到达终点的最小花费是多少?(租车子的费用)  若无法到达终点,输出-1 不谈二分的写法.. 我们考虑离散化可修改的点  和限制的点位置…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships con…
C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t m…
A. Santa Claus and a Place in a Class 模拟题.(0:12) 题意:n列桌子,每列m张桌子,每张桌子一分为2,具体格式看题面描述.给出n,m及k.求编号为k的桌子在第几行第几列是左还是右. 思路:由图知k为奇数在左边.每列有2*m个数,k/(2*m)然后就可以知道在第几列.然后数据小遍历找到第几行. int main() { int n,m,k; while(~scanf("%d%d%d",&n,&m,&k)) { char…
题目链接:http://codeforces.com/problemset/problem/729/C C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service, and he wants to reach cinem…
The organizers of a programming contest have decided to present t-shirts to participants. There are six different t-shirts sizes in this problem: S,M, L, XL, XXL, XXXL (sizes are listed in increasing order). The t-shirts are already prepared. For eac…
This is an interactive problem. You should use flush operation after each printed line. For example, in C++ you should usefflush(stdout), in Java you should use System.out.flush(), and in Pascal — flush(output). In this problem you should guess an ar…
Vasily exited from a store and now he wants to recheck the total price of all purchases in his bill. The bill is a string in which the names of the purchases and their prices are printed in a row without any spaces. Check has the format "name1price1n…
Vasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations: multiply the current number by 2 (that is, replace the number x by 2·x); append the digit 1 to the right of current number (that is, r…
B. Box Permutation p is a sequence of integers p=[p1,p2,-,pn], consisting of n distinct (unique) positive integers between 1 and n, inclusive. For example, the following sequences are permutations: [3,4,1,2], [1], [1,2]. The following sequences are n…
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) #include <bits/stdc++.h> using namespace std; int n,m,k; ; int main() { cin>>n>>m>>k; ;i<=k-;++i) { sum+=(n+(m-))*-(i)*; } cout<<sum<<endl;…
A - Forgetting Things 题意:给 \(a,b\) 两个数字的开头数字(1~9),求使得等式 \(a=b-1\) 成立的一组 \(a,b\) ,无解输出-1. 题解:很显然只有 \(a=b\) 和 \(a=b-1\) 的时候有解,再加上一个从 \(9\) 越到 \(10\) 的就可以了.被样例的 \(199,200\) 误导了. #include<bits/stdc++.h> using namespace std; typedef long long ll; int mai…
A. k-rounding 题目意思:给两个数n和m,现在让你输出一个数ans,ans是n倍数且末尾要有m个0; 题目思路:我们知道一个数末尾0的个数和其质因数中2的数量和5的数量的最小值有关系,所以我们可以把n中的2和5的因子数量分别算出来,然后看一下是否都大于等于m,否则我们就把他们补成m个.然后再乘回去就结束了. 题目链接:http://codeforces.com/contest/861/problem/A 代码: /* *********************************…
C. Did you mean... time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search…
B. Which floor? time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output In a building where Polycarp lives there are equal number of flats on each floor. Unfortunately, Polycarp don't remember how…
A. k-rounding time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros i…
A. Right-Left Cipher time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp loves ciphers. He has invented his own cipher called Right-Left. Right-Left cipher is used for strings. To encr…
http://codeforces.com/contest/1072/problem/D bfs 走1步的最佳状态 -> 走2步的最佳状态 -> …… #include <bits/stdc++.h> using namespace std; #define ll long long #define minv 1e-6 #define inf 1e9 #define pi 3.1415926536 #define nl 2.7182818284 ; ; struct node {…
https://codeforces.com/contest/1072/problem/D 题意 给你一个n*n充满小写字母的矩阵,你可以更改任意k个格子的字符,然后输出字典序最小的从[1,1]到[n,n]的路径(1<=n<=2000) 思路 我的 定义dp[i][j]为从[1,1]到[i,j]字符串最小的字符串,然后枚举所有i-1+j-1+1<=k的点,然后字符串连接比较,代表更改前面i,j个字符 这种思路有两个问题,如何处理出从[i,j]到[n,n]的最小字典序字符串,第二假如i+j…
A. Search for Pretty Integers 题目链接:http://codeforces.com/contest/872/problem/A 题目意思:题目很简单,找到一个数,组成这个数的数字即在A数组中出现过,也在B数组中出现过,问这个数最小是多少. 题目思路:首先要么一个数两个数组都出现过直接输出来,要么分别取两个数组中最小的数组合一下输出. 代码: //Author: xiaowuga #include <bits/stdc++.h> using namespace st…
地址:http://codeforces.com/contest/872/problem/D 题目: D. Something with XOR Queries time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. Jury has hidden a permutati…