MCPcopy Create free account
hub / github.com/acm-clan/algorithm-stone / main

Function main

user/codeforces/10A.Power Consumption Calculation.cpp:7–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5int l,r,s,ans=0;
6
7int main()
8{
9 scanf("%d%d%d%d%d%d",&n,&p1,&p2,&p3,&t1,&t2);
10 for(int i=1;i<=n;i++)
11 {
12 scanf("%d%d",&l,&r);
13 if(i>1)
14 {
15 ans=ans+min(t1,l-s)*p1;
16 if(l-s>t1)
17 {
18 ans=ans+min(l-s-t1,t2)*p2;
19 if(l-s>t1+t2)
20 {
21 ans=ans+(l-s-t1-t2)*p3;
22 }
23 }
24 }
25 ans=ans+(r-l)*p1;
26 s=r;
27 }
28 printf("%d",ans);
29
30 return 0;
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected