3588 번 : Water Main Break 
 3588 번 
 3588 번 - Water Main Break 
 A few weeks ago , in fact , right after restrictions on water usage by individuals had been announced , a water main broke right on the campus of our friends in Westwood . You may recall the images of a completely flooded campus , with entire garages underwater and students kayaking around . It took LADWP half an eternity to fix , and by the time they had fixed it , 20 million gallons of water 1 had been wasted . Given the aging infrastructure we have ( many water pipes in the US are 100 years old ) , we should expect this to be quite regular . And in fact , water main breaks do happen on a regular basis . 
 In this problem , you will be given information on a number of water main breaks : when they started , when they ended , and at what rate the water flowed out . You will also be given a time interval , and are to compute how much water in total was wasted during that interval . 
 1 That corresponds to the combined daily water usage of about 130 , 000 LA residents . 
 Notice that the water main break is fixed at time fi + 1 , so that ri gallons of water leave at times si , si + 1 , si + 2 , . . . , fi − 1 , fi 
 Then , on a line by itself , print the total number of gallons of water that have been wasted during the interval [ s , f ] . Notice that we thus count water that is leaking at times s , s + 1 , . . . , f − 1 , f . 
 University > The USC Programming Contest > Fall 2014 C 번