1440. [NOIP2013]积木大赛

★★   输入文件:BlockNOIP2013.in   输出文件:BlockNOIP2013.out   简单对比
时间限制:1 s   内存限制:128 MB

【题目描述】

【输入格式】BlockNOIP2013.in

输入文件改为BlockNOIP2013.in

【输出格式】BlockNOIP2013.out

输出文件改为BlockNOIP2013.out

【来源】

CCF全国信息学奥林匹克联赛(NOIP2013)复赛Day2

太感动了 NOIP出这么简单的水题

看这里!https://www.cnblogs.com/Tidoblogs/p/11412163.html

完全一样

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
int X=; bool flag=; char ch=getchar();
while(ch<''||ch>'') {if(ch=='-') flag=; ch=getchar();}
while(ch>=''&&ch<='') {X=(X<<)+(X<<)+ch-''; ch=getchar();}
if(flag) return X;
return ~(X-);
}
int main()
{
freopen("BlockNOIP2013.in","r",stdin);
freopen("BlockNOIP2013.out","w",stdout);
int n=read();
int pre=,Now;
long long ans=;
for(int i=;i<=n;i++)
{
Now=read();
ans+=(Now>pre)*1ll*(Now-pre);
pre=Now;
}
printf("%lld",ans);
return ;
}

cogs 1440. [NOIP2013]积木大赛 贪心水题的更多相关文章

  1. LOJ2611. NOIP2013 积木大赛 【线段树】

    LOJ2611. NOIP2013 积木大赛 LINK 题目大意是给你一个目标状态数组 每次你可以选择一个连续区间加上一个值,求最小操作次数 我是神奇的脑子 最近做数据结构疯了 然后看见这题就数据结构 ...

  2. PAT甲题题解-1125. Chain the Ropes (25)-贪心水题

    贪心水题,每次取最短的两个绳子合并,长度缩减成一半 #include <iostream> #include <cstdio> #include <algorithm&g ...

  3. NOIP2013积木大赛

    题目描述 春春幼儿园举办了一年一度的“积木大赛”.今年比赛的内容是搭建一座宽度为n的大厦,大厦可以看成由n块宽度为1的积木组成,第i块积木的最终高度需要是hi. 在搭建开始之前,没有任何积木(可以看成 ...

  4. noip2013 积木大赛

    题目描述 春春幼儿园举办了一年一度的“积木大赛”.今年比赛的内容是搭建一座宽度为n的大厦,大厦可以看成由n块宽度为1的积木组成,第i块积木的最终高度需要是hi. 在搭建开始之前,没有任何积木(可以看成 ...

  5. 【贪心算法】POJ-2393 简单贪心水题

    一.题目 Description The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over ...

  6. UVA 11389 The Bus Driver Problem 贪心水题

    题目链接:UVA - 11389 题意描述:有n个司机,n个早班路线和n个晚班路线,给每个司机安排一个早班路线和一个晚班路线,使得每个早班路线和晚班路线只属于一个司机.如果一个司机早班和晚班总的驾驶时 ...

  7. UVa(11292),贪心水题

    蓝书P1, 很简单的一个贪心选择,用能力小的去砍小的.本来想双重循环,哎,傻逼了,直接遍历选手,碰到能砍的就砍掉. #include <stdio.h> #include <algo ...

  8. codeforces 672C - Recycling Bottles 贪心水题

    感觉很简单,就是讨论一下 #include <stdio.h> #include <string.h> #include <algorithm> #include ...

  9. CF 322B Ciel and Flowers 贪心水题

    B. Ciel and Flowers time limit per test 1 second memory limit per test 256 megabytes input standard ...

随机推荐

  1. tf.variable_scope 参数

    最近在看TensorFlow的变量管理,发现很多代码中tf.variable_scope()参数的数量及意义还不太清楚,特此记录: def __init__(self, name_or_scope, ...

  2. Codeforces Round #183 (Div. 2)

    A. Pythagorean Theorem II 暴力,\(O(n^2)\). B. Calendar 每个日期计算到0年1月1日的天数,相当于转化成前缀和形式. 闰年数计算\[\lfloor\fr ...

  3. 被孟加拉题吊打的ACM考试

    https://codeforces.com/gym/101864 题目并不难 B 考虑新加入的线段和之前线段有交的个数 总数-不交的,不交的:右端点在[l,r]左边,左端点在[l,r]右边的. 维护 ...

  4. Python3内置函数、各数据类型(int/str/list/dict/set/tuple)的内置方法快速一览表

    Python3内置函数 https://www.runoob.com/python3/python3-built-in-functions.html int https://www.runoob.co ...

  5. Spring Security 学习笔记-信道过滤器

    信道过滤器主要职责是拦截不合规则的http请求,比如规定只能通过https访问资源,那么信道拦截器做相应的拦截处理,把http请求重定向为https请求,https请求则不做任何处理. 配置方式参照: ...

  6. CodeForces 906D (欧拉降幂)

    Power Tower •题意 求$w_{l}^{w_{l+1}^{w_{l+2}^{w_{l+3}^{w_{l+4}^{w_{l+5}^{...^{w_{r}}}}}}}}$ 对m取模的值 •思路 ...

  7. SPOJ - REPEATS Repeats (后缀数组)

    A string s is called an (k,l)-repeat if s is obtained by concatenating k>=1 times some seed strin ...

  8. HDU - 6333 Problem B. Harvest of Apples (莫队)

    There are nn apples on a tree, numbered from 11 to nn. Count the number of ways to pick at most mm a ...

  9. 初识Contiv

    Contiv是一个用于跨虚拟机.裸机.公有云或私有云的异构容器部署的开源容器网络架构.作为业界最强大的容器网络架构,Contiv具有2层.3层.overlay和ACI模式,能够与思科基础设施进行本地集 ...

  10. 魅族--魅蓝metal

      评论:金属潮流平民化