forked from sitz/UVa-Online-Judge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path10528.cpp
56 lines (54 loc) · 999 Bytes
/
10528.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <bits/stdc++.h>
using namespace std;
int main()
{
bool result[12];
string input;
int diff[8] = {0, 2, 4, 5, 7, 9, 11, 12};
const string notes[25] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C"};
vector<string> scales[12];
for (int i = 0; i < 12; i++)
{
for (int j = 0; j < 8; j++)
{
scales[i].push_back(notes[i + diff[j]]);
}
}
for (int i = 0; i < 12; i++)
{
result[i] = true;
}
while (cin >> input)
{
if (input == "END")
{
break;
}
for (int i = 0; i < 12; i++)
{
if (find(scales[i].begin(), scales[i].end(), input) == scales[i].end())
{
result[i] = false;
}
}
if (cin.peek() == '\n')
{
bool first = true;
for (int i = 0; i < 12; i++)
{
if (result[i] == true)
{
if (!first)
{
cout << " ";
}
cout << notes[i];
first = false;
}
result[i] = true;
}
cout << endl;
}
}
return 0;
}