Advertisement
Spocoman

Everest

Sep 18th, 2023
824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int reachedHeight = 5364, days = 1, daylyHeight;
  7.  
  8.     string sleep;
  9.  
  10.     while (reachedHeight < 8848) {
  11.         cin >> sleep;
  12.  
  13.         if (sleep == "END") {
  14.             break;
  15.         }
  16.         else if (sleep == "Yes") {
  17.             days++;
  18.             if (days == 6) {
  19.                 break;
  20.             }
  21.         }
  22.  
  23.         cin >> daylyHeight;
  24.         reachedHeight += daylyHeight;
  25.     }
  26.  
  27.     if (reachedHeight >= 8848) {
  28.         cout << "Goal reached for " << days << " days!\n";
  29.     }
  30.     else {
  31.         cout << "Failed!\n" << reachedHeight << endl;
  32.     }
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement