博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 1455 Sticks
阅读量:5150 次
发布时间:2019-06-13

本文共 1288 字,大约阅读时间需要 4 分钟。

Sticks
Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u
Submit     

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. 

Output

The output file contains the smallest possible length of original sticks, one per line. 

Sample Input

95 2 1 5 2 1 5 2 141 2 3 40

Sample Output

65
#include
#include
#include
using namespace std;int st[65];bool vis[65];int cnt;int n;int l;bool cmp(int a,int b){ return a>=b;}bool dfs(int num,int len){ if(num==cnt) return true; for(int i=0;i
View Code

 

转载于:https://www.cnblogs.com/superxuezhazha/p/5720425.html

你可能感兴趣的文章
1分钟搞定Android开发智能提示问题xml文件一并搞定
查看>>
4分钟学会网页样式
查看>>
Java核心技术点之注解
查看>>
【PHP】array_column函数
查看>>
LayUI--表格 + 分页
查看>>
mysql不能连接的原因
查看>>
centos6.x yum出错不能使用
查看>>
【OpenJ_Bailian - 2287】Tian Ji -- The Horse Racing (贪心)
查看>>
循环引用 。 @class
查看>>
rabbitmq
查看>>
Java网络编程--socket服务器端与客户端讲解
查看>>
Git 中README.md中MarkDown语法示例
查看>>
Android实现双进程守护
查看>>
IPC,Hz(Hertz) and Clock Speed
查看>>
C++ Primer 第二章 学习笔记
查看>>
List_统计输入数值的各种值
查看>>
Cocos2d-x 的“HelloWorld” 深入分析
查看>>
别让青春再浪费_个人经历
查看>>
POJ2566-Bound Found (尺取法)
查看>>
学习笔记-KMP算法
查看>>