SOJ.Opening Ceremony
2015-03-29 20:41
651 查看
1003. Opening Ceremony | ||||||
| ||||||
时间限制:1秒 内存限制:256兆 题目描述 For the grand opening of the algorithmic games in NlogNsglow, a row of tower blocks is set to be demolished in a grand demonstration of renewal. Originally the plan was to accomplish this with controlled explosions, one for each tower block, but time constraints now require a hastier solution. To help you remove the blocks more rapidly you have been given the use of a Universal Kinetic / Incandescent Energy Particle Cannon (UKIEPC). On a single charge, this cutting-edge contraption can remove either all of the floors in a single tower block, or all the x-th floors in all the blocks simultaneously, for user’s choice of the floor number x. In the latter case, the blocks that are less than x floors high are left untouched, while for blocks having more than x floors, all the floors above the removed x-th one fall down by one level. Given the number of floors of all towers, output the minimum number of charges needed to eliminate all floors of all blocks. 输入格式 The first line of input contains the number of blocks n, where 2 <= n <= 100 000. The second line contains n consecutive block heights hi for i = 1, 2, ..., n, where 1 <= hi <= 1 000 000. 输出格式 Output one line containing one integer: the minimum number of charges needed to tear down all the blocks. 样例输入 将样例输入复制到剪贴板 样例一: 6 2 1 8 8 2 3 样例二: 5 1 1 1 1 10 样例输出 样例一: 5 样例二: 2 Problem Source: 2015年每周一赛第四场 |
相关文章推荐
- ASPM Opening Ceremony
- CF 2014 Nordic Collegiate Programming Contest E Opening Ceremony
- NCPC 2014 Problem E Opening Ceremony Problem ID: ceremony
- The Opening Ceremony of my blog
- Closing Ceremony of the ATHENS 2004 Olympic Games
- Blogger Opening ...
- cisco路由器错误%Error opening tftp://255.255.255.255/network config
- [导入]Opening
- Opening Files Whose Type is Unknown
- 安装aptana插件报Error opening the editor. java.lang.NullPointerException
- SOJ 3366 watering hole
- soj 3252 大组合数取模
- soj 3137 Simple Computing 容斥原理 hdu 1796 How many integers can you find
- SicilyOJ(SOJ) 1302 Magic Square(Merzirac解奇幻方)
- TOJ 3486 SOJ 1009 母函数
- SOJ 2209 递推 大数
- [小e笔记]之翻译的翻&译文的译——Ora-600 [4193] WhenOpening Or Shutting Down A Database [ID 452662.1]
- VM 虚拟机, linux mount windows的共享目录,php报错:Fatal error: Unknown: Failed opening required
- soj 1763. 传球游戏
- soj 1197. Hotel