C. Block Towers 题目连接: http://www.codeforces.com/contest/626/problem/C Description Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces…
题目链接:http://codeforces.com/contest/626/problem/C 题意就是给你n个分别拿着2的倍数积木的小朋友和m个分别拿着3的倍数积木的小朋友,每个小朋友拿着积木的数量互不相同,求小朋友中拿着最大积木数的最小的情况(有点绕). 那最坏的情况就是2n或者3m,假设最大的积木数为x,x肯定能被2或3整除,那么x/2就是2的倍数个数,x/3就是3的倍数的个数,x/6就是6的倍数的个数. 因为这个数据量很小,那么只要暴力寻找刚好符合x/3 + x/2 - x/6 >=…
在家补补题   模拟 A - Robot Sequence #include <bits/stdc++.h> char str[202]; void move(int &x, int &y, char ch) { if (ch == 'U') x--; if (ch == 'D') x++; if (ch == 'L') y--; if (ch == 'R') y++; } int main(void) { int n; scanf ("%d", &…
D. Jerry's Protest 题目连接: http://www.codeforces.com/contest/626/problem/D Description Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replaceme…
C. Lieges of Legendre 题意:给n,m表示有n个为2的倍数,m个为3的倍数:问这n+m个数不重复时的最大值 最小为多少? 数据:(0 ≤ n, m ≤ 1 000 000, n + m > 0) ps:很水的题,主要是策略: 思路:由于里面每隔6就会重复一次,不好直接模拟,并且模拟的效率很低,那就二分吧!二分即上界为2单独的最大倍数与3单独时的最大倍数之和,下界为前面二者的max;之后利用判断是否mid/2 >= n && mid/3 >= m &am…
F - Group Projects 题目大意:给你n个物品, 每个物品有个权值ai, 把它们分成若干组, 总消耗为每组里的最大值减最小值之和. 问你一共有多少种分组方法. 思路:感觉刚看到的时候的想法是先排好序, dp[ i ][ j ][ k ]表示已经划分了 i 个, 并且分成了 j 组, 目前为止的总消耗为k的方案总数. 但是这个状态没有办法转移, 题解提供了一种将贡献分段的方法, 比如说原数组为1 2 3 6 7 8 10, 其中一组里面有 1 3 7 8 那么我们不是 直接计算出(8…
G. Raffles 题目连接: http://www.codeforces.com/contest/626/problem/G Description Johnny is at a carnival which has n raffles. Raffle i has a prize with value pi. Each participant can put tickets in whichever raffles they choose (they may have more than o…
F. Group Projects 题目连接: http://www.codeforces.com/contest/626/problem/F Description There are n students in a class working on group projects. The students will divide into groups (some students may be in groups alone), work on their independent piec…
E. Simple Skewness 题目连接: http://www.codeforces.com/contest/626/problem/E Description Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list of n (not necessarily distinct) integers. Fi…
B. Cards 题目连接: http://www.codeforces.com/contest/626/problem/B Description Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can do one of two actions: take any two (not ne…