Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main() {
- double guests, budget;
- cin >> guests >> budget;
- budget -= ceil(guests / 3) * 4 + guests * 2 * 0.45;
- if (budget < 0) {
- cout << "Lyubo doesn't have enough money.\n"
- << "He needs " << fixed << setprecision(2) << abs(budget) << " lv. more.\n";
- }
- else {
- cout << "Lyubo bought " << ceil(guests / 3) << " Easter bread and " << guests * 2 << " eggs.\n"
- << "He has " << fixed << setprecision(2) << budget << " lv. left.\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement