http://codeforces.com/problemset/problem/10/A
题很简单,就是题意难懂啊。。。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <stdio.h> 2 #include <iostream> 3 #include <string.h> 4 using namespace std; 5 const int N=102; 6 struct node 7 { 8 int l,r; 9 } g[N]; 10 int main() 11 { 12 int n,p1,p2,p3,t1,t2; 13 while(cin>>n>>p1>>p2>>p3>>t1>>t2) 14 { 15 int sum = 0; 16 for (int i = 1; i <= n; i++) 17 { 18 cin>>g[i].l>>g[i].r; 19 sum+=(g[i].r-g[i].l)*p1; 20 } 21 for (int i = 2; i <= n; i++) 22 { 23 int x = g[i].l-g[i-1].r; 24 sum+=min(x,t1)*p1; 25 x-=min(x,t1); 26 sum+=min(x,t2)*p2; 27 x-=min(x,t2); 28 sum+=x*p3; 29 } 30 cout<<sum<<endl; 31 } 32 return 0; 33 }