sgu551 Preparing Problem】的更多相关文章

题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=551 呵呵,题目读的没错,可惜理解错了..== #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #define LL long long using namespace std; int n, t1, t2; int gcd(int a,…
sgu 542 Gena vs Petya sgu 543 Cafe 题意:有N组人需要被分配到某些固定了人数的桌子上,其中ai表示第i组有多少个人,安排作为需要符合如下安排:某一组的人员不能够单独在一张桌子,每张桌子坐的人数不能够超过其限制,问至少要安排多少张给定了人数限制的桌子. 分析:此题是一个贪心题,如果直接求解的话,由于桌子的数量是未知的,因此不太好分配,因此二分桌子的数量,在已知桌子的数量后运用贪心规则来求得最优解.但尽管在二分已知桌子的情况下还是不太好实现这个贪心规则.其思路是这样…
NEERC Southern Subregional 2012 Problem B. Chess Championship 题目描述:有两个序列\(a, b\),两个序列都有\(n\)个数,并且这\(2n\)个数两两不同,现在要将这两个序列里的数两两配对,组成\(n\)个数对,要求数对中\(a\)的数比\(b\)的数大的数对个数要比其它的多\(m\)个.问方案数. solution 将这\(2n\)个数从小到大排,预处理出前\(i\)个数中\(a, b\)的个数\(suma, sumb\), \…
题意: 给出n个数字,要求在这n个数中选出至少两个数字,使得它们的和在l,r之间,并且最大的与最小的差值要不小于x.n<=15 Problem - 550B - Codeforces 二进制 利用二进制, 第i位为1则加上a[i], 为0则不加, #include<iostream> #include <algorithm> #include <cmath> #include<map> using namespace std; typedef long…
B. Preparing Olympiad You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made. A problemset for the contest must consist of at le…
B. Preparing Olympiad Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem/B Description You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for…
Preparing Olympiad time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemse…
Problem H. Hard TestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description Andrew is having a hard time preparing his 239-th contest for Petrozavodsk. This time the solution to the problem is based on Di…
Food Problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5445 Description Few days before a game of orienteering, Bell came to a mathematician to solve a big problem. Bell is preparing the dessert for the gam…
Problem Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what they remember is that MS Inc. posted a surplus or a deficit each month of 1999 and e…