Advertisement
Toliak

ъеъ

Oct 18th, 2018
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. struct Subject {
  7.     string name;
  8.     int mark;
  9. };
  10.  
  11. struct Student {
  12.     std::string name;
  13.     Subject subjects[4];
  14. };
  15.  
  16. int main()
  17. {
  18.     int n;
  19.     cin >> n;
  20.     auto students = new Student[n];
  21.     for (int i = 0; i < n; i++)
  22.     {
  23.         cin >> students[i].name;
  24.         for (int j = 0; j < 4; j++)
  25.         {
  26.             cin >> students[i].subjects[j].name;
  27.             cin >> students[i].subjects[j].mark;
  28.         }
  29.     }
  30.     int result = 0;
  31.     for (int i = 0; i < n; i++)
  32.     {
  33.         bool isFullFive = true;
  34.         for (int j = 0; j < 4; j++)
  35.         {
  36.             if (students[i].subjects[j].mark != 5)
  37.             {
  38.                 isFullFive = false;
  39.                 break;
  40.             }
  41.         }
  42.         if (isFullFive)
  43.             result++;
  44.     }
  45.     cout << result << endl;
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement