Cod sursa(job #943870)
| Utilizator | Data | 26 aprilie 2013 18:20:15 | |
|---|---|---|---|
| Problema | Branza | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in ("branza.in");
ofstream out("branza.out");
int const N=100005;
int n,s,t,cost[N],cant[N];
int main()
{
in>>n>>s>>t; int suma=0;
for(int i=1;i<=n;i++)
in>>cost[i]>>cant[i];
for(int i=n;i>t;i--)
for(int j=1;j<t;j++)
if(cost[i]>cost[i-j]+s*j)
cost[i]=cost[i-j]+s*j;
for(int i=1;i<=n;i++)
suma+=cost[i]*cant[i];
out<<suma<<"\n";
return 0;
}
