1. 程式人生 > >HDU 1698 Just a Hook【線段樹—區間更新】

HDU 1698 Just a Hook【線段樹—區間更新】

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.



Now Pudge wants to do some operations on the hook.

Let us number the consecutive metallic sticks of the hook from 1 to N. For each operation, Pudge can change the consecutive metallic sticks, numbered from X to Y, into cupreous sticks, silver sticks or golden sticks.
The total value of the hook is calculated as the sum of values of N metallic sticks. More precisely, the value for each kind of stick is calculated as follows:

For each cupreous stick, the value is 1.
For each silver stick, the value is 2.
For each golden stick, the value is 3.

Pudge wants to know the total value of the hook after performing the operations.
You may consider the original hook is made up of cupreous sticks.

相關推薦

HDU 1698 Just a Hook線段區間更新

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic stic

hdoj 1698 Just a Hook 線段 區間更新

cas ack case 鏈接 pre turn 個數 oid mod 題目大意:有一段鏈子。初始的時候是銅的(價值為1),n代表有n段(1~n),輸入a, b, c三個數分別表示將從a到b的鏈子的價值改為c, 最後問你經過多次改變之後的

HDU 1698 Just a Hook線段區間更新入門題)

follow and iostream http span meta ali pos num Just a Hook Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O

HDU 1698 Just a Hook線段-區間更新

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sti

HDU 1166 —— Just a Hook 線段 區間修改

http://acm.hdu.edu.cn/showproblem.php?pid=1698 要求:   1. 區間修改   2. 最後整個區間求和 分析:   因為沒有多次查詢,而只有最後的一次整個區

HDU 1698 Just a Hook線段區間更新

題意: 屠夫是Dota中一個令所有英雄聞風喪膽的英雄。他有一個很長的鉤子,這個鉤子是用銅做的(剛剛開始都是1),現在他想要更改這些鉤子,把某個區間的鉤子改為金、銀或銅。 輸入 L, R,

HDU 1698 Just a Hook線段 區間更新區間求和)

題意: 有一個鉤子由n個小棒構成,每個小棒有三種類型,長度分別為:1,2,3;一共有m次操作,m次操作後詢問問鉤子的長度, 注意:鉤子的初始長度為n,即每個葉子節點的值為1 AC程式碼: //裸模板題

HDU 1698 Just a Hook線段 區間更新 + 查詢區間和)

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic stic

hdu 1698 Just a Hook線段——區間更新

Just a Hook Problem Description In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes

1698 Just a Hook線段 區間更新

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sti

1698 Just a Hook線段區間更新區間查詢)

Just a Hook Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 41024    Accepted Submission

POJ 1698 Just a Hook線段 區間更新

Just a Hook Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 41166    Accepted Su

HDU 1689 Just a Hook線段區間更新+求和)

ise down using tick 代碼 precise ble pda desc Just a Hook Problem Description In the game of DotA, Pudge’s meat hook is actually the most h

HDU 1698 Just a Hook線段成段更新

there clas class rec std sts present script metal 題目網址:http://acm.hdu.edu.cn/showproblem.php?pid=1698 題目: Problem Description In the ga

HDU-1698 Just a Hook線段、段變換(覆蓋))

++ first rom c11 scan limit field sticks example Just a Hook Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/

題解報告:hdu 1698 Just a Hook線段lazy標記的運用)

http som height sum cup ive first 報告 original Problem Description In the game of DotA, Pudge’s meat hook is actually the most horrible th

HDU 1698 Just a Hook線段區間更新

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several c

HDU 1698 Just a Hook線段區間更新

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consec

hdu 1698 Just a Hook線段基礎)

成段更新的線段樹,加入了延時標記............ 線段樹這種東西細節上的理解因人而異,還是要自己深入理解......慢慢來 #include <iostream> #include <algorithm> #include <cmat

hdu 1698 Just a Hook線段區間更新及求和)

#include<iostream> #include<cstdio> #include<cstring> using namespace std; #define N 100010 struct Node{ int L; int R; int V;