题目链接:http://codeforces.com/problemset/problem/282/E E. Sausage Maximization time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Bitlandians are quite weird people. They have their own prob…
题意:你的手机有\(n\)个app,每个app的大小为\(a_i\),现在你的手机空间快满了,你需要删掉总共至少\(m\)体积的app,每个app在你心中的珍惜值是\(b_i\),\(b_i\)的取值为\(1\)或\(2\),现在问你至少删掉体积\(m\)的app的最小珍惜值是多少,如果不能满足条件,输出\(-1\). 题解:因为\(b_i\)的取值只有\(1\)和\(2\),所以我们肯定优先选珍惜值\(1\)的体大的app,这样贪心的话,我们将\(1\)和\(2\)分开,从大排序,记录\(1\…
[codeforces 509]C. Sums of Digits 试题描述 Vasya had a strictly increasing sequence of positive integers a1, ..., an. Vasya used it to build a new sequence b1, ..., bn, where bi is the sum of digits of ai's decimal representation. Then sequence ai got lo…
题目链接:http://codeforces.com/problemset/problem/509/E 题意:给你一个字符串,求字串中包括子串中I, E, A, O, U, Y.所占的概率和. 题解:有些技巧的题目,关于概率之和可以考虑每个点单独处理然后最终求和. 假设i点是I, E, A, O, U, Y中的一个. 以i为终点的概率之和.(字符串从1开始) 1+1/2+1/3+....1/i=sum[i]; 以i为起点不包括i单点的情况. 1/2+1/3+....1/(len-i+1)=sum…
C. Riding in a Lift Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/480/problem/C Description Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors f…
You want to perform the combo on your opponent in one popular fighting game. The combo is the string ss consisting of nn lowercase Latin letters. To perform the combo, you have to press all buttons in the order they appear in ss . I.e. if s=s= "abca&…
F. Video Cards time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named Bota-3. Of course…
D. Gadgets for dollars and pounds time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for po…
题目传送门 题目大意:给出n个数字,m次区间询问,每一次区间询问都是询问 l 到 r 之间出现次数为偶数的数 的亦或和. 思路:偶数个相同数字亦或得到0,奇数个亦或得到本身,那么如果把一段区间暴力亦或,得到的其实就是出现次数为奇数的数字的亦或和,所以我们希望这段区间内的所有数字出现次数都+1,使奇偶性互换. 我们先处理出前缀的亦或和,这样可以得到次数为奇数的亦或和. 接下来的问题就是要改变一段区间的奇偶性了,也就是说,这个问题其实就转化成了如何求一段区间出现的所有数字(无重复). 这里我学到的是…
A. Points in Segments time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a set of nn segments on the axis OxOx , each segment has integer endpoints between 11 and mm inclusive. S…