Advertisement
Guest User

Escala musical

a guest
Sep 21st, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.06 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <fstream>
  5. #include <math.h>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.  
  12.     int n, a;
  13.     cin >> n;
  14.  
  15.     vector<int> v;
  16.     for(int i = 0; i < n; i++)
  17.     {
  18.         cin >> a;
  19.         v.push_back(a);
  20.     }
  21.  
  22.     for(int i = 0; i < n; i++)
  23.     {
  24.         v[i] %= 12;
  25.         if(v[i] == 0)
  26.             v[i] = 12;
  27.     }
  28.  
  29.     vector<int> notas(13, 0);
  30.     for(int i = 0; i < n; i++)
  31.     {
  32.         if(notas[v[i]] == 0)
  33.             notas[v[i]]++;
  34.     }
  35.  
  36.          if(notas[2] == 0 & notas[4] == 0 & notas[7] == 0 & notas[9] == 0 & notas[11] == 0)
  37.         cout << "do" << endl;
  38.     else if(notas[3] == 0 & notas[5] == 0 & notas[8] == 0 & notas[10] == 0 & notas[12] == 0)
  39.         cout << "do#" << endl;
  40.     else if(notas[4] == 0 & notas[6] == 0 & notas[9] == 0 & notas[11] == 0 & notas[1] == 0)
  41.         cout << "re" << endl;
  42.     else if(notas[5] == 0 & notas[7] == 0 & notas[10] == 0 & notas[12] == 0 & notas[2] == 0)
  43.         cout << "re#" << endl;
  44.     else if(notas[6] == 0 & notas[8] == 0 & notas[11] == 0 & notas[1] == 0 & notas[3] == 0)
  45.         cout << "mi" << endl;
  46.     else if(notas[7] == 0 & notas[9] == 0 & notas[12] == 0 & notas[2] == 0 & notas[4] == 0)
  47.         cout << "fa" << endl;
  48.     else if(notas[8] == 0 & notas[10] == 0 & notas[1] == 0 & notas[3] == 0 & notas[5] == 0)
  49.         cout << "fa#" << endl;
  50.     else if(notas[9] == 0 & notas[11] == 0 & notas[2] == 0 & notas[4] == 0 & notas[6] == 0)
  51.         cout << "sol" << endl;
  52.     else if(notas[10] == 0 & notas[12] == 0 & notas[3] == 0 & notas[5] == 0 & notas[7] == 0)
  53.         cout << "sol#" << endl;
  54.     else if(notas[11] == 0 & notas[1] == 0 & notas[4] == 0 & notas[6] == 0 & notas[8] == 0)
  55.         cout << "la" << endl;
  56.     else if(notas[12] == 0 & notas[2] == 0 & notas[5] == 0 & notas[7] == 0 & notas[9] == 0)
  57.         cout << "la#" << endl;
  58.     else if(notas[1] == 0 & notas[3] == 0 & notas[6] == 0 & notas[8] == 0 & notas[10] == 0)
  59.         cout << "si" << endl;
  60.     else
  61.         cout << "desafinado" << endl;
  62.  
  63.     return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement