Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

20行16ms

Posted by vook at 2017-03-27 22:07:04 on Problem 2393
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator