Advertisement
Alx09

Untitled

Mar 2nd, 2021
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include<iostream>
  2. #include<stdio.h>
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.     int v[1000] = {}, max = 0;
  8.     int startTime[1000], endTime[1000], n;
  9.     cout << "Numar de studenti: "; cin >> n;
  10.     for (int i = 1; i <= n; i++) {
  11.         cout << "Student " << i << endl;
  12.         cout << "Start Time: "; cin >> startTime[i];
  13.         cout << "End Time: "; cin >> endTime[i];
  14.     }
  15.     for (int i = 1; i <= n; i++) {
  16.         for (int j = 1; j <= n; j++) {
  17.             if (startTime[j] >= startTime[i] && startTime[j] <= endTime[i]) v[i]++;
  18.         }
  19.     }
  20.     for (int i = 1; i <= n; i++)if (v[i] > max) max = v[i];
  21.     cout << "Numar maxim de studenti: " << max;
  22. }
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement