Description

Tia Dalma: Come. What service may I do you? You know I demand payment.
Jack: I brought payment. Look. An undead monkey. Top that.

Tia Dalma: The payment is fair.
Old Captain Jack Sparrow’s friend Tia Dalma, the fortuneteller and
prophetess, often makes potions. She has an outstanding collection of
the rarest ingredients such as rat tails, fingers of drowned, tears of
virgins and so on. And all these ingredients require special care.
Recently Tia Dalma received some good skins of bats as a payment, and
now she wants to dry them. To dry ingredients fortuneteller usually uses
specially prepared books as the magical properties of the skins could
be lost during prolonged contact with other objects. Tia Dalma knows how
many sheets should be on both sides of the skin to save it unspoiled.
For a i-th skin that number is ai, that is, the distance from it to the neighboring skins and the book cover can’t be less than ai
sheets. Help a fortuneteller determine the minimum number of sheets
that should be in the book to save rare ingredients from damage.

Input

The first line contains integer n  that is the number of skins (1 ≤
n ≤ 100). The second line contains n integers ai (1 ≤
ai ≤ 100).

Output

Output the minimal required number of sheets in the book.

Sample Input

input output
3
5 10 3
#include<iostream>
#include<cstdio>
#include<string.h>
#include<algorithm>
using namespace std; int main()
{
int n;
int a[];
int sum;
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
sum=;
for(int i=;i<n;i++)
sum+=a[i];
sum+=a[n-];
printf("%d\n",sum);
}
return ;
}

读题吧  亲~~~ 看我下次还能不能读懂!!!!!!!!!!!!!!!!

E - Tears of Drowned的更多相关文章

  1. Timus 1935. Tears of Drowned 具体解释

    Old Captain Jack Sparrow's friend Tia Dalma, the fortuneteller and prophetess, often makes potions. ...

  2. “You couldn’t see my tears cause I am in the water.“ Fish said to water.“But I could feel your tears cause you are in my heart..“ Answered water.

    “You couldn’t see my tears cause I am in the water.“ Fish said to water.“But I could feel your tears ...

  3. DAGs with NO TEARS: Continuous Optimization for Structure Learning

    DAGs with NO TEARS: Continuous Optimization for Structure Learning 目录 DAGs with NO TEARS: Continuous ...

  4. The Sorrows of Young Werther

    The Sorrows of Young Werther J.W. von Goethe Thomas Carlyle and R.D. Boylan Edited by Nathen Haskell ...

  5. python瓦登尔湖词频统计

    #瓦登尔湖词频统计: import string path = 'D:/python3/Walden.txt' with open(path,'r',encoding= 'utf-8') as tex ...

  6. 定时Job在IIS中潜在危险-IIS 定期回收

    引言 有时我们会在IIS中启用一些定时服务,但是你必须清楚IIS会定期回收Asp.net的应用程序的.首先来看IIS啥时候回收APPDomain.   APPDomain 回收时机 There are ...

  7. DotNet 资源大全中文版(Awesome最新版)

    Awesome系列的.Net资源整理.awesome-dotnet是由quozd发起和维护.内容包括:编译器.压缩.应用框架.应用模板.加密.数据库.反编译.IDE.日志.风格指南等. 算法与数据结构 ...

  8. 【机器学习Machine Learning】资料大全

    昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...

  9. 基于Netbeans的PHPUnit单元测试环境搭建

    一.配置 PHPUnit截至2015-10-16,稳定版已更新至5.0.6,要求使用PHP v5.6及以上的环境才能使用. PHPUnit的4.8系列要求在PHP v5.3.3以上环境使用. Netb ...

随机推荐

  1. 在eclipse中import java web项目时遇到的一些问题并将该项目通过tomcat发布

    1.首先是import一个新的项目,会将已有的项目import到working space中,注意,你现在的项目路径就在working space了,而不是已有的项目路径! 2.点击eclipse上面 ...

  2. Luogu 2059 [JLOI2013]卡牌游戏 - 概率DP

    Solution 设状态 $F[i][j] $为 还剩余 $i$ 个人时, 第 $j$ 个人 的胜率. 边界: $F[1][1] = 1$(只剩下一个人了). 这样设置状态就能使 $i-1$ 个人的答 ...

  3. 清晰易懂!关于PS入门的超详细笔记!

    给大家分享一篇关于PS入门的超详细笔记!原理讲解清晰明了,虽不是新版本解析,但都是新手学习PS必掌懂的一些知识点,灰常的实用,转走收藏学习! 编辑:千锋UI设计 来源:PS学堂

  4. TCHAR函数查询

    https://blog.csdn.net/is2120/article/details/27542927

  5. Python之路(第五篇) Python基本数据类型集合、格式化、函数

    一.变量总结 1.1 变量定义 记录某种状态或者数值,并用某个名称代表这个数值或状态. 1.2 变量在内存中的表现形式 Python 中一切皆为对象,数字是对象,列表是对象,函数也是对象,任何东西都是 ...

  6. kbmmw 的HTTPSmartService中的跨域访问

    有同学在使用kbmmw 与extjs 结合的时候,涉及到了跨域访问,这个在 kbmmw 里面已经完全解决. extjs 在访问跨域的时候,首先会使用OPIONS  调用,服务端要根据浏览器请求的 he ...

  7. 51.从首页内容跳转到第二个Tabbar控制器(controller)

    TabBarController: 创建TabBar的控制器 注意:在点击的内容方法页面,添加头文件 #import "TabBarController.h" #import &q ...

  8. 695. Max Area of Island

    static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { publ ...

  9. 【fiddler】抓取https数据失败,全部显示“Tunnel to......443”

    这个问题是昨天下午就一直存在的,知道今天上午才解决,很感谢“韬光养晦”. 问题描述:  按照网络上的教程,设置fiddler开启解密https的选项,同时fiddler的证书也是安装到系统中,但是抓取 ...

  10. tp5中代替tp3.2中的一些方法

    U方法 U方法是TP中的生成路由的内置方法,现在这个方法可以完全使用url方法替换 I方法 之前的TP有个I方法用来接收请求参数,目前可以使用input方法替代 C方法 c方法被config方法代替