[2016年NOIP普及组] 买铅笔
#include<iostream> int main() { int num; std::cin>>num; int mt=99999999; for(int i=0;i<3;i++) { int price,number; std::cin>>number>>price; std::div_t calc=div(num,number); int take=calc.quot; if(calc.rem)//进一法 take++; mt=std::min(mt,std::multiplies<int>()(take,price)); } std::cout<<mt; }