Advertisement
Spocoman

Deer of Santa

Sep 17th, 2023 (edited)
629
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int days;
  8.     cin >> days;
  9.  
  10.     double availableFood, deer1, deer2, deer3;
  11.     cin >> availableFood >> deer1 >> deer2 >> deer3;
  12.  
  13.     availableFood -= (deer1 + deer2 + deer3) * days;
  14.  
  15.     if (availableFood >= 0) {
  16.         cout << floor(availableFood) << " kilos of food left.\n";
  17.     }
  18.     else {
  19.         cout << ceil(abs(availableFood)) << " more kilos of food are needed.\n";
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement