1125 Chain the Ropes
题意:略。
思路:思考一下,最先拿去对折的绳子会参与之后的每次对折,而对一条绳子而言,对折的次数越多剩下的就越短,因此,要让最终的结果尽可能长,应该先让较短的绳子先对折。
代码:
#include <cstdio>
#include <algorithm>
using namespace std;
;
int segment[maxn];
int main()
{
int n;
scanf("%d",&n);
;i<n;i++)
scanf("%d",&segment[i]);
sort(segment,segment+n);
];
;i<n;i++)
ans=(ans+segment[i])/;
printf("%d",ans);
;
}
1125 Chain the Ropes的更多相关文章
- 1125 Chain the Ropes (25 分)
1125 Chain the Ropes (25 分) Given some segments of rope, you are supposed to chain them into one rop ...
- PAT甲级 1125. Chain the Ropes (25)
1125. Chain the Ropes (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given ...
- PAT 1125 Chain the Ropes[一般]
1125 Chain the Ropes (25 分) Given some segments of rope, you are supposed to chain them into one rop ...
- PAT 1125 Chain the Ropes
Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fo ...
- 1125. Chain the Ropes (25)
Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fo ...
- PAT甲题题解-1125. Chain the Ropes (25)-贪心水题
贪心水题,每次取最短的两个绳子合并,长度缩减成一半 #include <iostream> #include <cstdio> #include <algorithm&g ...
- PAT1125:Chain the Ropes
1125. Chain the Ropes (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given ...
- PAT_A1125#Chain the Ropes
Source: PAT A1125 Chain the Ropes (25 分) Description: Given some segments of rope, you are supposed ...
- A1125. Chain the Ropes
Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fo ...
随机推荐
- tomcat学习篇
要求: 为Apache HTTP Server服务器添加JSP网页支持. 能够访问Tomcat容器的Web管理界面,以便管理各种JSP.Servelet应用. u 知识提示 在各种企业级网站应用系统中 ...
- HBase Cassandra比较
转自:http://itindex.net/detail/22338-cassandra-hbase-%E8%AE%BE%E8%AE%A1 Cassandra HBase 一致性 Quorum ...
- [eShopOnContainers 学习系列] - 01 - Roadmap and Milestones for future releases
https://github.com/dotnet-architecture/eShopOnContainers/wiki/01.-Roadmap-and-Milestones-for-future- ...
- react use simditor
1.install simditor 2.import simditor && scss import $ from "jquery" import Simdito ...
- 【python】import问题总结
一.绝对引用 首先总结一下import的各种姿势: 1.import package 读这个包的__init__.py 2.import module 读这个模块全部内容 3.import packa ...
- Qt之图形(QPainterPath)
简述 QPainterPath 类(绘图路径)提供了一个容器,用于绘图操作,可以创建和重用图形形状. 绘图路径是由许多图形化的构建块组成的对象,例如:矩形.椭圆.直线和曲线.构建块可以加入在封闭的子路 ...
- OLE剪切板与拖拽
https://www.xuebuyuan.com/1074399.html https://blog.csdn.net/uda1985/article/details/6179801
- ng 依赖注入
将依赖的对象注入到当前对象,直接去使用依赖的对象即可. 降低耦合度.提高开发速度.. 文件压缩:yui-compressor有两种方案:①CLI(command line interface)java ...
- Manual Install Cocos2d-x vc template on Windows 7
Manual Installation Process Download the template file from HERE and extract it. Open the file CCApp ...
- 【转载】VC获取MAC地址的4种方法
From:http://blog.csdn.net/pdfmaker/article/details/465748 有需求才有创造,有了问题才会想着去解决,那么我这里的获取MAC地址的第4种方法也是在 ...