北大poj- 1032】的更多相关文章

原文地址:北大POJ题库使用指南 北大ACM题分类主流算法: 1.搜索 //回溯 2.DP(动态规划)//记忆化搜索 3.贪心 4.图论 //最短路径.最小生成树.网络流 5.数论 //组合数学(排列组合).递推关系.质因数法 6.计算几何 //凸壳.同等安置矩形的并的面积与周长.凸包计算问题 8.模拟 9.数据结构 //并查集.堆.树形结构 10.博弈论 11.CD有正气法题目分类: 1. 排序 1423, 1694, 1723, 1727, 1763, 1788, 1828, 1838, 1…
题目地址:http://poj.org/problem?id=1032 Parliament Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17473   Accepted: 7371 Description New convocation of The Fool Land's Parliament consists of N delegates. According to the present regulation…
Description New convocation of The Fool Land's Parliament consists of N delegates. According to the present regulation delegates should be divided into disjoint groups of different sizes and every day each group has to send one delegate to the concil…
Parliament Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16521   Accepted: 6975 Description New convocation of The Fool Land's Parliament consists of N delegates. According to the present regulation delegates should be divided into dis…
题意:给出一个数n,将其拆分为若干个互不相等的数字的和,要求这些数字的乘积最大. 分析:我们可以发现任何一个数字,只要能拆分成两个大于1的数字之和,那么这两个数字的乘积一定大于等于原数.也就是说,对于连乘式中,如果将一个乘数a更换为两个数字b×c(a=b+c且b>1,c>1),那么乘积只可能增大或不变,不会减小.所以我们拆分的原则就是将这些数字拆得尽量小,拆成许多2的乘积是最好的.又因为题目约束各个数字不能相同,则我们拆分的结果最理想的情况是从2开始的公差为1的等差数列.但是有时是无法构成这样…
给出n,把n分解为若干不相同数之和,使之乘积最大.贪心,Discuss里面的思路:把n分解为从2开始的连续整数,如果有多,则从高位开始依次加1.如26,我们得到2+3+4+5+6,此时还剩余6(26-2-3-4-5-6),接下来从高位依次加一,变成3+4+5+6+7,还剩1,继续加给最大的7,最后答案是3+4+5+6+8 #include <iostream> #include <cstdio> using namespace std; int main() { // freope…
Parliament Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19103   Accepted: 8101 Description New convocation of The Fool Land's Parliament consists of N delegates. According to the present regulation delegates should be divided into dis…
#include<iostream> using namespace std; int main() { int n; int num; ; int i,j; cin>>num; ;;i++){ sum+=i; ){ ;j<=i+;j++) cout<<j<<" "; break; } if(num-sum<i){ n=i-num+sum; ;j<=i;j++) if(j>n) cout<<j+<…
看了园友的评论之后,我也好奇清橙OJ是怎么计算内存占用的.重新测试的情况附在原文后边. -------------------------------------- 这是切割线 -------------------------------------------- 最近自学Java,试着用Java刷几道OJ的题来熟悉基本语法. 起初几道简单题,没太留意程序的执行效率.今天做了一道简单的递归题,竟然运行超时了!由于本人算法方面功底太差,不懂的如何优化,想了个投机的办法应付了过去.但又觉得不可思议…
Network Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 14021   Accepted: 5484   Special Judge Description Andrew is working as system administrator and is planning to establish a new network in his company. There will be N hubs in the c…