Advertisement
Spocoman

06. Oscars

Sep 7th, 2023
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     string name;
  8.     getline(cin, name);
  9.  
  10.     double points;
  11.     cin >> points;
  12.  
  13.     int juryNum;
  14.     cin >> juryNum;
  15.     cin.ignore();
  16.  
  17.     string judgeName;
  18.     double judgePoints;
  19.  
  20.     for (int i = 0; i < juryNum; i++) {
  21.         getline(cin, judgeName);
  22.         cin >> judgePoints;
  23.         cin.ignore();
  24.  
  25.         points += judgeName.length() * judgePoints / 2;
  26.  
  27.         if (points > 1250.5) {
  28.             break;
  29.         }
  30.     }
  31.  
  32.     cout.setf(ios::fixed);
  33.     cout.precision(1);
  34.  
  35.     if (points > 1250.5) {
  36.         cout << "Congratulations, " << name << " got a nominee for leading role with " << points << "!\n";
  37.     }
  38.     else {
  39.         cout << "Sorry, " << name << " you need " << 1250.5 - points << " more!\n";
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement