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. UI设计教程分享:字体变形—阴阳收缩法

    阴阳师中国古代对自然规律发展变化基础因素的描述,是古代美学逻辑思维.推理分析的核心要素,也是描述万物基本要素和成因的概念之一.阴阳代表事物的对立关系,它是自然界的客观规律,是万物运动变化的本源,是人类 ...

  2. jQuery操作(二)

    一: 操作元素 1. 属性操作 1.1 $("p").text() $("p").html() $(":checkbox").val() 1 ...

  3. mysql 5.7.10 下互为主备配置

    mysql安装方法这里就不在介绍,网上有很多教程 环境介绍: A主机: win2008_x64+mysql5.7.10 64位,ip192.168.7.180 B主机: win2008_x64+mys ...

  4. echart 3 数据密集时,断点不显示问题

    如上图最开始标识的两点是不显示的,配置处理代码如下(series中配置symbolSize: 1,showAllSymbol: true): myChart.showLoading(); $.get( ...

  5. 在win8 App中,StorageFile比Path更好用

    Skip the path: stick to the StorageFile: http://blogs.msdn.com/b/wsdevsol/archive/2012/12/05/stray-f ...

  6. decode 横竖转换

    select rq 日期,sum(decode(shengfu,'胜',1,'负',0)) 胜,sum(decode(shengfu,'负',1,'胜',0)) 负 from tmp group by ...

  7. 前端之javascript的节点操作和Event

    一 节点的增删改查 创建节点:createElement(标签名):创建一个指定名称的节点. 追加节点: 追加一个子节点:somenode.appendChild(标签名) 指定某个位置前面添加一个节 ...

  8. 学会谈判zz

    经常有人问我,为什么谈判到你手里就变得那么容易?你有什么诀窍?其实只要是谈判,涉及双方利益,就绝不会轻松.之所以能谈判成功,仔细想想秘诀无非是两个字:“双赢”.要想成功,就要双方都受益.如果你一开始就 ...

  9. myeclipse部署项目的时候报No projects are available for deployment to this server但是项目明明存在

    如题,今天在尝试部署从SVN上down下来的项目时,发现不能被tomcat识别成web项目!原因是SVN上down下来的项目的结构并非典型的web项目.  解决办法,右键项目->properti ...

  10. 2019.02.09 bzoj1042: [HAOI2008]硬币购物(完全背包+容斥原理)

    传送门 题意简述:有四种面值的硬币,现在qqq次询问(q≤1000)(q\le1000)(q≤1000),每次给出四种硬币的使用上限问最后刚好凑出sss块钱的方案数(s≤100000)(s\le100 ...