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. canvas粒子系统的构建

    前面的话 本文将从最基本的imageData对象的理论知识说开去,详细介绍canvas粒子系统的构建 效果演示 下面是实例效果演示,博文结尾有全部源码 imageData 关于图像数据imageDat ...

  2. python+selenium自动化软件测试(第14章):基础实战(1)

    #coding=utf- from selenium import webdriven from selenium.webdriver.common.by import By from seleniu ...

  3. shell之参数传递

    我们可以在执行 Shell 脚本时,向脚本传递参数,脚本内获取参数的格式为:$n.n 代表一个数字,1 为执行脚本的第一个参数,2 为执行脚本的第二个参数,以此类推-- 实例 以下实例我们向脚本传递三 ...

  4. C# 使用NPOI 实现Excel的简单导入导出

    private void btnImport_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); DataTable dt ...

  5. JDBCTemplate

    1.Spring提供的一个操作数据库的技术JdbcTemplate,是对Jdbc的封装.语法风格非常接近DBUtils. JdbcTemplate可以直接操作数据库,加快效率,而且学这个JdbcTem ...

  6. Visual Studio2017 远程调试 Remote Debugger

    前言 大家在使用vs打包后的文件部署到服务器后,有时候我们需要对线网的后台进行调试.但是它不像在VS中.这个时候我们该怎么调试呢? 微软想到了这一点,他们在 VS 中给我们提供了一个功能: Remot ...

  7. TP5.0实现无限极回复功能

    最近做项目的时候用到了评论回复,使用ThinkPHP5.0框架做回复碰到了一些问题,简单总结一下.(李昌辉) 1.首先是数据表的设计: create table zy_huifu ( code int ...

  8. Maven简述

    一.前言     以前做过的项目中,没有真正的使用过Maven,只知道其名声很大,其作用是用来管理jar 包的.最近一段时间在项目过程中使用Maven,用Maven构建的web项目,其项目结构只停留在 ...

  9. 最近找java实习面试被问到的东西总结(Java方向)

    时间,就是这么很悄悄的溜走了将近两个年华,不知不觉的,研二了,作为一个一般学校的研究生,不知道该说自己是不学无术,还是说有过努力,反正,这两年里,有过坚持,有过堕落,这不,突然间,有种开窍的急迫感,寻 ...

  10. Windows noinstall zip 安装MySQL。

    听完数据库老师的课,想在Windows下通过命令行的方法安装MySQL5.7,于是开了这个坑,终于把这个坑填上了. 第一步:下载MySQL 的noinstall zip ,点击该链接下载,或者复制链接 ...