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 disjoint groups of different sizes and every day each group has to send one delegate to the conciliatory committee. The composition of the conciliatory committee should be different each day. The Parliament works only while this can be accomplished. 
You are to write a program that will determine how many delegates should contain each group in order for Parliament to work as long as possible. 

Input

The input file contains a single integer N (5<=N<=1000 ).

Output

Write to the output file the sizes of groups that allow the Parliament to work for the maximal possible time. These sizes should be printed on a single line in ascending order and should be separated by spaces.

Sample Input

7

Sample Output

3 4

Source

 
 
看国家集训队2003论文集 邵烜程:《数学思想助你一臂之力》其中有详解;
 
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std; int n,tot,f[],ans,sum; int main(){
while(scanf("%d",&n)==){
tot=;
memset(f,,sizeof(f));
sum=n;
for(int i=;i<=n&&i<=sum;i++){
tot++;
f[tot]=i;
sum=sum-i;
}
if(sum==tot+) f[tot]++;
for(int i=tot;i>=tot-sum+;i--)
f[i]++;
for(int i=;i<tot;i++)
printf("%d ",f[i]);
if(tot) printf("%d",f[tot]);
printf("\n");
}
}

Poj 1032 Parliament的更多相关文章

  1. poj 1032 Parliament 【思维题】

    题目地址:http://poj.org/problem?id=1032 Parliament Time Limit: 1000MS   Memory Limit: 10000K Total Submi ...

  2. (Relax 水题1.2)POJ 1032 Parliament(将n分解成若干个互不相等的整数的和,并且是这些整数的乘积最大)

    题意:给出一个数n,将其拆分为若干个互不相等的数字的和,要求这些数字的乘积最大. 分析:我们可以发现任何一个数字,只要能拆分成两个大于1的数字之和,那么这两个数字的乘积一定大于等于原数.也就是说,对于 ...

  3. POJ 1032问题描述

    Description New convocation of The Fool Land's Parliament consists of N delegates. According to the ...

  4. Poj 1032 分类: Translation Mode 2014-04-04 09:09 111人阅读 评论(0) 收藏

    Parliament Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16521   Accepted: 6975 Descr ...

  5. 【贪心】 poj 1032 和为n的若干数最大乘积

    给出n,把n分解为若干不相同数之和,使之乘积最大.贪心,Discuss里面的思路:把n分解为从2开始的连续整数,如果有多,则从高位开始依次加1.如26,我们得到2+3+4+5+6,此时还剩余6(26- ...

  6. POJ 1032

    #include<iostream> using namespace std; int main() { int n; int num; ; int i,j; cin>>num ...

  7. POJ题目排序的Java程序

    POJ 排序的思想就是根据选取范围的题目的totalSubmittedNumber和totalAcceptedNumber计算一个avgAcceptRate. 每一道题都有一个value,value ...

  8. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  9. 算法之路 level 01 problem set

    2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 ...

随机推荐

  1. Java自定义注解及使用

    本文通过一个简单的例子展示注解的工作原理. 1.声明注解类型 @Target(value = ElementType.METHOD) //声明该注解的运行目标: 方法 @Retention(value ...

  2. Jmeter之接口测试

    最近才入职新公司,好几天没有写博客了,经过一个朋友提醒,刚刚好觉得用Jmeter来做接口测试真的是再好不过了.下面就详细讲解下这两天我利用Jmeter做的接口测试. [安装Jmeter] 详细见博文: ...

  3. poj2912 Rochambeau

    Description N children are playing Rochambeau (scissors-rock-cloth) game with you. One of them is th ...

  4. 微信H5支付:网络环境未能通过安全验证,请稍后再试。解决办法(PHP版)

    前(tu)言(cao) (这段前言纯属吐槽,着急解决问题的小伙伴,赶紧看正文吧) 最近做了支付宝和微信支付,先做的是PC端网站的支付,就是出个二维码,然后手机扫描支付,当然支付宝在扫码页面支持登录支付 ...

  5. HTML+CSS画一朵向日葵

    前几天看到一张图片,倔强的向日葵.(BGM,<倔强>) 看着挺有感触,就想用CSS做一个向日葵. 最终效果图如下: 主要的难点就在花瓣的处理上,css暂时没有做到这样的尖角圆弧. 我想到的 ...

  6. TF-IDF学习(python实现)

    从大一开始接触TF-IDF,一直觉得这个特别简单,,但是图样图森破,,, 即使现在来说,也似乎并非完全搞懂 核心思想: 计算词语在该文章中权重,与词语出现次数和词语价值有关 词语出现次数,重复即强调, ...

  7. spring mvc:注解@ModelAttribute妙用

    在Spring mvc中,注解@ModelAttribute是一个非常常用的注解,其功能主要在两方面: 运用在参数上,会将客户端传递过来的参数按名称注入到指定对象中,并且会将这个对象自动加入Model ...

  8. ArrayBuffer和TypedArray,以及Blob的使用

    前端使用TypedArray编辑二进制 ES6提供了, ArrayBuffer和TypedArray, 让前端也可以直接操作编辑二进制数据, 网页中的类型为file的input标签, 也可以通过Fil ...

  9. System.Globalization.CultureInfo.InvariantCulture 解决不同地域字符串格式不同问题

    同样的DateTime.ToShortDateString()   在不同的地域输出格式不同 如在美国的 日期格式为 :  月-日-年 如在中国的 日期格式为 :  年-月-日 一些时候,这个格式就会 ...

  10. 201521123065《java程序设计》第10周学习总结

    1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结异常与多线程相关内容. 2. 书面作业 本次PTA作业题集异常.多线程 finally 题目4-2 1.1 截图你的提交结果(出现学 ...