Advertisement
Spocoman

Renovation

Sep 21st, 2023
931
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int x, y, nonPaint;
  8.     cin >> x >> y >> nonPaint;
  9.  
  10.     double neededPaint = 1.0 * x * y * 4 * (100.0 - nonPaint) / 100;
  11.  
  12.     string command;
  13.     cin >> command;
  14.  
  15.     while (command != "Tired!") {
  16.         neededPaint -= stoi(command);
  17.         if (neededPaint <= 0) {
  18.             break;
  19.         }
  20.         cin >> command;
  21.     }
  22.  
  23.     if (neededPaint > 0) {
  24.         cout << neededPaint << " quadratic m left.\n";
  25.     }
  26.     else if (neededPaint == 0) {
  27.         cout << "All walls are painted! Great job, Pesho!\n";
  28.     }
  29.     else {
  30.         cout << "All walls are painted and you have " << abs(neededPaint) << " l paint left!\n";
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement