Advertisement
MiinaMagdy

12554 - A Special "Happy Birthday" Song!!!

Sep 1st, 2022
1,268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6. #define endl '\n'
  7. #define sz(x) int(x.size())
  8. #define all(x) x.begin(), x.end()
  9.  
  10. int main() {
  11.     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  12.     int n;
  13.     cin >> n;
  14.     vector<string> names(n);
  15.     for (int i = 0; i < n; i++) {
  16.         cin >> names[i];
  17.     }
  18.     vector<string> song = {
  19.         "Happy", "birthday", "to", "you",
  20.         "Happy", "birthday", "to", "you",
  21.         "Happy", "birthday", "to", "Rujia",
  22.         "Happy", "birthday", "to", "you"
  23.     };
  24.     int m = sz(song);
  25.     bool done = false;
  26.     int i = 0;
  27.     while (!done) {
  28.         for (int j = 0; j < m; j++) {
  29.             cout << names[i++] << ": " << song[j] << endl;
  30.             i %= n;
  31.             done |= (i == 0);
  32.         }
  33.     }
  34.     return 0;
  35. }
  36.  
Tags: UVA CP3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement