Pagini recente » Cod sursa (job #1714282) | Borderou de evaluare (job #2078045) | Cod sursa (job #160271) | Cod sursa (job #996632) | Cod sursa (job #238331)
Cod sursa(job #238331)
#include<stdio.h>
int g,w,eg,cg;
void calcul()
{
int e=0,cost=0,ce=0,ccost=0;
for(int i=0;i<=g;++i)
{
scanf("%d%d",&eg,&cg);
while(e!=w)
{
e=eg+e;
cost=cost+cg;
}
if(ccost==0)
ccost=cost;
if(cost<ccost)
ccost=cost;
e=0;
cost=0;
}
printf("%d",ccost);
}
int main()
{
freopen("energii.in","r",stdin);
freopen("energii.out","w",stdout);
scanf("%d%d",&g,&w);
calcul();
return 0;
}