1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include<bits/stdc++.h> using namespace std; int main(){ int need,number[3],price[3],zong[3],boxnum[3],ans,i,yushu[3]; cin>>need; ans=2147483647; for (i=0;i<3;++i) { cin>>number[i]>>price[i]; boxnum[i]=need/number[i]; yushu[i]=need%number[i]; if(yushu[i]!=0) boxnum[i]=boxnum[i]+1; zong[i]=boxnum[i]*price[i]; if(zong[i]<ans) ans=zong[i]; } cout<<ans; return 0; }
|