NOIP2018提高組T1題解
題目大家可以在洛谷上看見,其實就是NOIP2013提高組的原題。 程式碼都一樣。 主要的思想是差分陣列。 程式碼如下:
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
int n;
scanf("%d",&n);
int ans=0,last=0;
int x;
for(int i=0;i<n;i++){
scanf("%d",&x);
if(x>last){
ans+=x-last;
}
last=x;
}
printf("%d",ans);
return 0;
}
相關推薦
NOIP2018提高組T1題解
題目大家可以在洛谷上看見,其實就是NOIP2013提高組的原題。 程式碼都一樣。 主要的思想是差分陣列。 程式碼如下: #include<cstdio> #include<algori
[51Nod]NOIP2018提高組省一沖獎班模測訓練(四)翻車記+題解
problem ref sign 二分答案 def pointers 小時 https 奇怪 鏈接 下午5點的時候,突然想起來有這個比賽,看看還有一個小時,打算來AK一下,結果因為最近智商越來越低,翻車了,我還是太菜了。上來10分鐘先切掉了C和A,結果卡在了B題,唉。 A.
[51Nod]NOIP2018提高組省一沖獎班模測訓練(三) 題解
但是 clas ref 構造 efi const .html 題意 矩形 鏈接 A.Anan的派對 題意:Anan想舉辦一個派對。Anan的朋友總共有 n 人。第i個人如果參加派對會得到 \(c_i\) 的快樂值,除他自己外每多一個人參加他會減少 \(d_i\) 的快樂值
NOIP2018 提高組題解
Day1 T1 據說是原題積木大賽,但是考場上蠢了,只會寫資料結構,於是寫了一個線段樹\(+\)堆\(+\)貪心,先選出最小的,然後區間修改,然後把左右兩端區間的最小值丟進堆裡,不停從堆中去最小值更新即可(模擬題) #include <cstdio> #include <cstri
洛谷 題解 P5015 【標題統計】 NOIP2018 普及組 T1
stdio.h 理解 iso include %d num || code tdi 沒有人用 scanf("%c", &ch) != EOF 嗎? scanf 和 EOF 會傷心的。 思路:逐個讀入字符,遇到EOF中止,對於每個讀入的字符進行判斷
NOIp2018鋪設道路(提高組T1)————模擬,貪心
本題主要考查模擬,貪心,我們可以畫出柱狀圖來分析。當左邊的一堆比右邊矮,左邊的一堆擺完後,右邊的還差一點,那麼擺放次數s加上兩堆的高度差。 程式碼如下: #include<iostream> using namespace std; int n,sum=0,i,j; int
【NOIP2018 提高組 day2 T1】旅行
題目 思路 這道題60%的資料還是容易做; 這要建圖的時候預處理一下,如何深搜就行了; 因為兩點之間有且只有一條路徑聯通; 因此選擇了了一條邊,就必須把這棵子樹走完; 所以我們每次都選擇節點最小的那子樹; 貪心就完事; 考慮100%,發現n<=5000可
NOIP2018提高組題解(附填數遊戲logn做法)
總體來說,Day1的3題非常水,Day2的難度卻飆升到一定境界了……然後我就GG了…… T1 鋪設道路 題目連結 這道題一眼原題,顯然,如果 d
NOIP 2006 提高組 t1 能量項鏈
發現 tdi -i clu 應該 else 能量 並且 最大 題目描述 在Mars星球上,每個Mars人都隨身佩帶著一串能量項鏈。在項鏈上有N顆能量珠。能量珠是一顆有頭標記與尾標記的珠子,這些標記對應著某個正整數。並且,對於相鄰的兩顆珠子,前一顆珠子的尾標記一定等於後
洛谷 P1125 笨小猴(NOIp2008提高組T1)
end ans 小寫字母 else 代碼 整數 turn clas efi 題目描述 笨小猴的詞匯量很小,所以每次做英語選擇題的時候都很頭疼。但是他找到了一種方法,經試驗證明,用這種方法去選擇選項的時候選對的幾率非常大! 這種方法的具體描述如下:假設maxn是單詞中出現次數
關於”NOIP2018提高組初賽解析”博客引起的聲明道歉+自我檢討
模擬試題 tro 中學 學會 出了 P20 為我 不顯示 題目 關於”NOIP2018提高組初賽解析”博客引起的聲明道歉+自我檢討 本人是余姚中學高一學生俞鑫顏,因在博客園發表了”NOIP2018提高組初賽解析”這條博客,引起了全國範圍內部分OI選手、老師的恐慌和不安,
NOIP2018提高組模擬題(五)
一個 con mat space 特殊 pen prime pri print 字符串(string) Description 小林與亮亮正在做一個遊戲。小林隨意地寫出一個字符串,字符串只由大寫 字母組成,然後指定一個非負整數 m,亮亮可以進行至多 m 次操作,每次操作
NOIP2018提高組初賽滾粗記
先扯 多少分已不重要。一切都在預料之中。 初賽涼涼。 準備什麼,那一方面的知識就非常非常簡單,簡單到不用準備。 不準備什麼,那一方面的知識就能卡住人。 這篇部落格之前沒有發出去?! 具體報告 選擇題一個2分?!劣勢。 第7題,不會積分啊。。。。 怎麼做? 第8題 教練講了課,
NOIP2018提高組金牌訓練營——動態規劃專題
整數 mil 提高 targe 背包 r+ 美的 png tps NOIP2018提高組金牌訓練營——動態規劃專題 https://www.51nod.com/Live/LiveDescription.html#!#liveId=19 多重
NOIP2018提高組省一衝獎班模測訓練(五)
NOIP2018提高組省一衝獎班模測訓練(五) http://www.51nod.com/Contest/ContestDescription.html#!#contestId=79 今天有點浪…… 第一題想了一個多小時想到了正解,然後敲到一半就去看lol總決賽了(恭喜IG!!!!!!)
2018年11月1日提高組 T1 可見點數
大意 給定一個 n × n n\
NOIP2018提高組省一衝獎班模測訓練(一)
比賽連結 https://www.51nod.com/contest/problemList.html#!contestId=72&randomCode=147206 這次考試的題非常有質量 這次考試暴露了非常多的問題,心理給自己設限,知識點不熟練等等問題。 只拿了暴力的分。
NOIP2018提高組遊記(祭?)
Day0 早上8點,機房集合,然後開始最後一天的頹掙扎。 隔壁jacktang大爺一大早花三分鐘手擼了個樹套樹板子,展示了手速的極限2333,李尋歡奆佬正看著各種博弈論的論文(貌似是想自己發一篇?) 還有隔壁gstdio大爺(學弟?)正在死磕一道黑得發亮(或許那叫深藍?)的數論題,然後,,,草稿紙亂飛啊
[NOIp2013提高組]積木搭建/[NOIp2018提高組]鋪設道路
[NOIp2013提高組]積木搭建/[NOIp2018提高組]鋪設道路 題目大意: 對於長度為\(n(n\le10^5)\)的非負數列\(A\),每次可以選取一個區間\(-1\)。問將數列清零至少需要幾次操作。 思路: 差分後,將大於\(0\)的差分累加入答案即可。 原始碼: #include&l
[NOIp2018提高組]貨幣系統
[NOIp2018提高組]貨幣系統 題目大意: 有\(n(n\le100)\)種不同的貨幣,每種貨幣的面額為\([1,25000]\)之間的一個整數。若兩種貨幣系統能夠組合出來的數是相同的的,那我們就稱這兩種貨幣系統是等價的。給定一個貨幣系統,求不同面額貨幣數最少的等價的貨幣系統。 思路: 將面額從小