标签:min storage man style def produced ini detail desc
4 5 88 200 89 400 97 300 91 500Sample Output
126900Hint
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <iostream> #include <vector> #define ll long long #define MAXN 50010 using namespace std; int cost[MAXN],mai[MAXN]; int n,s; ll ans=0; int main() { scanf("%d%d",&n,&s); for(int i=1;i<=n;i++){ scanf("%d%d",&cost[i],&mai[i]); } for(int wek=1;wek<=n;wek++){ int minn=1<<30; for(int i=1;i<=wek;i++){ minn=min(minn,cost[i]+s*(wek-i)); } ans+=minn*mai[wek]; } printf("%lld",ans); return 0; }
标签:min storage man style def produced ini detail desc
原文地址:http://www.cnblogs.com/renjianshige/p/7425147.html