Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
20行16ms#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int c,s; int main() { int n,m; scanf("%d%d",&n,&m); long long ans=0; scanf("%d%d",&c,&s); int k=c; ans+=k*s; for(int i=1;i<n;i++) { scanf("%d%d",&c,&s); k=min(k+m,c); ans+=k*s; } printf("%lld\n",ans); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator