测试样例
input #1
57
2 2
50 30
30 27
output #1
54
input #2
9998
128 233
128 2333
128 666
output #2
18407
input #3
9999
101 1111
1 9999
1111 9999
output #3
89991
测试网站 https://www.luogu.com.cn/problem/P1909
#include<bits/stdc++.h>
using namespace std;
int n;
int num,val,now,ans=0x3f3f3f3f,k;
int main() {
cin>>n;
if(n==0) {
cout<<"0";
return 0;
}
for(int i=0; i<3; i++) {
cin>>num>>val;
k=ceil(n*1.0/num);
now=k*val;
ans=min(ans,now);
}
cout<<ans;
return 0;
}
#include<cmath>
double ceil(double x) 对x向上取整
double floor(double x)对x向下取整