E - Tears of Drowned
Description
Jack: I brought payment. Look. An undead monkey. Top that.
Tia Dalma: The payment is fair.
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.
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
n ≤ 100). The second line contains n integers ai (1 ≤
ai ≤ 100).
Output
Sample Input
input | output |
---|---|
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的更多相关文章
- Timus 1935. Tears of Drowned 具体解释
Old Captain Jack Sparrow's friend Tia Dalma, the fortuneteller and prophetess, often makes potions. ...
- “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 ...
- DAGs with NO TEARS: Continuous Optimization for Structure Learning
DAGs with NO TEARS: Continuous Optimization for Structure Learning 目录 DAGs with NO TEARS: Continuous ...
- The Sorrows of Young Werther
The Sorrows of Young Werther J.W. von Goethe Thomas Carlyle and R.D. Boylan Edited by Nathen Haskell ...
- python瓦登尔湖词频统计
#瓦登尔湖词频统计: import string path = 'D:/python3/Walden.txt' with open(path,'r',encoding= 'utf-8') as tex ...
- 定时Job在IIS中潜在危险-IIS 定期回收
引言 有时我们会在IIS中启用一些定时服务,但是你必须清楚IIS会定期回收Asp.net的应用程序的.首先来看IIS啥时候回收APPDomain. APPDomain 回收时机 There are ...
- DotNet 资源大全中文版(Awesome最新版)
Awesome系列的.Net资源整理.awesome-dotnet是由quozd发起和维护.内容包括:编译器.压缩.应用框架.应用模板.加密.数据库.反编译.IDE.日志.风格指南等. 算法与数据结构 ...
- 【机器学习Machine Learning】资料大全
昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...
- 基于Netbeans的PHPUnit单元测试环境搭建
一.配置 PHPUnit截至2015-10-16,稳定版已更新至5.0.6,要求使用PHP v5.6及以上的环境才能使用. PHPUnit的4.8系列要求在PHP v5.3.3以上环境使用. Netb ...
随机推荐
- 洛谷3119 [USACO15JAN]草鉴定Grass Cownoisseur
原题链接 显然一个强连通分量里所有草场都可以走到,所以先用\(tarjan\)找强连通并缩点. 对于缩点后的\(DAG\),先复制一张新图出来,然后对于原图中的每条边的终点向新图中该边对应的那条边的起 ...
- ES6 中 let and const
let 和 const 命令 let 命令 基本用法 ES6 新增了let命令,用来声明变量.它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效. { let a = 10; v ...
- ui设计用什么软件
Ui设计用什么软件?作为ui设计师,你必须要熟练的使用以下几款设计软件,不然可能也无法胜任ui设计师的职位. ui设计除了要学习一些基本的操作软件,如PS AI AE AXURE 以外呢,还要学习比如 ...
- Ubuntu 双网卡设置
闲话不多说,直接正题 因为chinanet信号不强,所以买了个usb无线网卡,平常又要做开发,要连着开发板,不知怎么回事,一旦自带无线网卡连上内网的无线路由,就不能访问外网了. 网上搜了好久,终于查到 ...
- python学习 day6 (3月7日)
#__author : 'liuyang' #date : 2019/3/7 0007 a = ['a' , 'b' , 'c'] b = [] print(a is b ) # 空元组 可以 空列表 ...
- mysql字符串类型数据
字符串类型是在数据库中存储字符串的数据类型,字符串类型包括char,varchar,text,enum和set. OK,我们来一个一个的看下上面提到的几种类型. char类型和varchar类型 ch ...
- 2019.01.22 51nod 1203 JZPLCM(线段树+链表)
传送门 一道很有意思的题. 题意简述:给一个数列,多次询问区间的lcmlcmlcm,答案对1e9+71e9+71e9+7取模. 思路:首先考虑到一个区间的lcmlcmlcm就是其中所有出现过的素数的最 ...
- tp5框架成功、失败提示模板修改
<!DOCTYPE html> <html> <head> <title> 页面自动中...跳转 等待时间:<?php echo($wait); ...
- 非关系型数据库MongoDB
爆炸式发展的NoSQL技术 在过去的很长一段时间中,关系型数据库(Relational Database Management System)一直是最主流的数据库解决方案,他运用真实世界中事物与关系来 ...
- SQL2008 2机镜像
清除设置 //删除端点 declare @sql varchar() declare @mirrName varchar() select @mirrName=name from sys.databa ...