P1909 [NOIP2016 普及组] 买铅笔
#include<iostream>
using namespace std;
int main(void)
{
//p1909
int n,n1,n2,n3,p1,p2,p3,t1,t2,t3,total;
cin>>n>>n1>>p1>>n2>>p2>>n3>>p3;
t1 = n % n1 == 0 ? (n / n1) * p1 : (n / n1 + 1) * p1;
t2 = n % n2 == 0 ? (n / n2) * p2 : (n / n2 + 1) * p2;
t3 = n % n3 == 0 ? (n / n3) * p3 : (n / n3 + 1) * p3;
total = t1;
if(total > t2)
{
total = t2;
}
if(total > t3)
{
total = t3;
}
cout<<total<<endl;
return 0;
}