PKU1011解题ing
2010-06-21 15:11
791 查看
要开始做PKU1011题了,先翻译一下:
PKU1011
Sticks
木棍
Description
问题描述
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally and how long they were originally. Please help him and design a program which computes the smallest possible original length of those sticks. All lengths expressed in units are integers greater than zero.
简单说来,就是把一些同样长度的木棍,随机的切断,切完之后,又把木棍的长度和数量都忘了,现在想要你编一个程序,把木棍的长度找出来,要求这个长度最小。
Input
The input contains blocks of 2 lines. The first line contains the number of sticks parts after cutting, there are at most 64 sticks. The second line contains the lengths of those parts separated by the space. The last line of the file contains zero.
输入包含两行,第一行是切断后的小木棍的总数,至多是64;第二行是小木棍的长度,用空格分开;最后一行是0,代表程序退出。
Output
The output should contains the smallest possible length of original sticks, one per line.
每一行输出可能的最小长度
Sample Input
9
5 2 1 5 2 1 5 2 1
4
1 2 3 4
0
Sample Output
6
5
我把它改成了一个数学题,是这样描述的:
假设有m个正整数X1,X2,X3,...Xm, 求一个正整数R,满足以下条件:
1)(X1+X2+X3+...+Xm)%R=0;也就是说总和可能整除R;
2)R>=X1,X2,X3,...Xm;R大于等于m个正整数里的任何一个;
3)恰巧能将这m个数据分成(X1+X2+X3+...+Xm)/R组,设共有t组,每一组的和为R;
4)R是满足以上三个条件的最小值;
PKU1011
Sticks
木棍
Description
问题描述
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had originally and how long they were originally. Please help him and design a program which computes the smallest possible original length of those sticks. All lengths expressed in units are integers greater than zero.
简单说来,就是把一些同样长度的木棍,随机的切断,切完之后,又把木棍的长度和数量都忘了,现在想要你编一个程序,把木棍的长度找出来,要求这个长度最小。
Input
The input contains blocks of 2 lines. The first line contains the number of sticks parts after cutting, there are at most 64 sticks. The second line contains the lengths of those parts separated by the space. The last line of the file contains zero.
输入包含两行,第一行是切断后的小木棍的总数,至多是64;第二行是小木棍的长度,用空格分开;最后一行是0,代表程序退出。
Output
The output should contains the smallest possible length of original sticks, one per line.
每一行输出可能的最小长度
Sample Input
9
5 2 1 5 2 1 5 2 1
4
1 2 3 4
0
Sample Output
6
5
我把它改成了一个数学题,是这样描述的:
假设有m个正整数X1,X2,X3,...Xm, 求一个正整数R,满足以下条件:
1)(X1+X2+X3+...+Xm)%R=0;也就是说总和可能整除R;
2)R>=X1,X2,X3,...Xm;R大于等于m个正整数里的任何一个;
3)恰巧能将这m个数据分成(X1+X2+X3+...+Xm)/R组,设共有t组,每一组的和为R;
4)R是满足以上三个条件的最小值;
相关文章推荐
- pku 1011 sticks 搜索+剪枝 解题报告
- pku 1011 解题报告
- pku 1011 解题报告
- PKU Campus 2015解题报告
- pku1011 深搜+强剪枝
- 空间人物行走的向量实现(pku1835解题报告)
- pku 1006 解题报告
- pku 1013 解题报告
- pku1160 Post Office 解题报告
- POJ 1001Exponentiation解题报告——求高精度幂——【PKU ACM】
- Pku 1080 Humman Gene Function 解题分析
- POJ 2362 POJ1011解题报告
- pku 1308 Is A Tree 搜索 解题报告
- pku 1466 Girls and Boys 最大独立集 解题报告
- ACM pku 1003 解题报告(练习输入输出)
- Pku acm 1887 Testing the CATCHER 动态规划题目解题报告(十一)
- Pku acm 1125 Stockbroker Grapevine 数据结构题目解题报告(八)---- 弗洛伊德(floyd)算法
- Pku acm 2418 Hardwood Species 排序算法解题报告(六) ----二叉查找数(BST)
- Pku acm 1423 Big Number 解题报告----求n!的位数
- Pku acm 1274 The Perfect Stall 数据结构题目解题报告(十三)---- 匈牙利算法求二分图的最大匹配