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. git报“commiter email "root@localhost.localdomain"does not match your user account”

    首先检查账户邮箱配置是否正确,检查方法: git config --list 发现邮箱及帐号配置正确,但是git push时仍然报如题错误: 原因:git执行add.commit 时已经记录下了做了该 ...

  2. BZOJ 1874 取石子游戏 - SG函数

    Description $N$堆石子, $M$种取石子的方式, 最后取石子的人赢, 问先手是否必胜 $A_i <= 1000$,$ B_i <= 10$ Solution 由于数据很小, ...

  3. IOS代码片段

    2017-08-03 获取应用程序委托FKAppDelegate* appDelegate = [UIApplication shareApplication].delegate 2017-08-03 ...

  4. IOS初级:导航控制器

    1.AppDelegate.m老生常谈了,创建window,创建根视图rootViewController - (BOOL)application:(UIApplication *)applicati ...

  5. 如何将service绑入到spring 并且在action中使用

    第一步:定制 service接口,为什么用接口我也不清楚 package com.inspur.services; import com.hsp.domain.User; public interfa ...

  6. maven打包证(支付)书问题

    要将证书文件后缀添加到resource文件夹内范围,添加打包文件后缀(include) 添加maven配置: <resources> <resource> <direct ...

  7. 24、JSON与OC互相转化

    一. JSON: 1. 01.JSON是一种轻量级的数据格式,一般用于数据交互 02.服务器返回给客户端的数据,一般都是JSON格式活着XML格式(文件下载除外) JSON的格式很像OC中的字典和数组 ...

  8. oracle 替换字符 replace

    替换字符: select replace('xxyyzz','zz','') from dual >> xxyy   同时替换多个字符: select replace(replace('x ...

  9. php-fpm 的 pm.start_servers 参数调整

    大家注意一下 在 php-fpm 的配置文件中, pm.start_servers 必须是介于  pm.min_spare_servers 和  pm.max_spare_servers  这个值之间 ...

  10. 2019.01.17 bzoj1854: [Scoi2010]游戏(二分图匹配)

    传送门 二分图匹配菜题. 题意:nnn个二元组(xi,yi)(x_i,y_i)(xi​,yi​),每个二元组可以选一个数总共nnn个数aia_iai​,问将aia_iai​排好序之后从111开始最多可 ...