10分求解

P1909 [NOIP2016 普及组] 买铅笔

@[WINDOWSareC](/user/852730) 有没有一种可能,money1、money2和money3的初值不一定是 $0$
by ImposterAnYu @ 2022-12-26 09:35:38


``` #include <iostream> using namespace std; int main() { int n, pencil; int money1 = 0, money2 = 0, money3 = 0; int bao1pencil, bao1money; int bao2pencil, bao2money; int bao3pencil, bao3money; cin >> n; cin >> bao1pencil >> bao1money; cin >> bao2pencil >> bao2money; cin >> bao3pencil >> bao3money; for(pencil = 0; pencil <= n; pencil += bao1pencil) money1 += bao1money; for(pencil = 0; pencil <= n; pencil += bao2pencil) money2 += bao2money; for(pencil = 0; pencil <= n; pencil += bao3pencil) money3 += bao3money; int money = min(min(money1, money2), money3); cout << money << endl; return 0; } ```
by Lovely_CCCyh___ @ 2022-12-26 09:43:10


@[cyh114514](/user/772909) 呃,46分
by WINDOWSareC @ 2022-12-27 09:11:10


我不知道了......
by Lovely_CCCyh___ @ 2022-12-27 11:35:31


|