forked from kothariji/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path094. Chord.cpp
54 lines (47 loc) · 891 Bytes
/
094. Chord.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
#include <bits/stdc++.h>
#define lli long long int
#define endl "\n"
using namespace std;
string all[24] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "B", "H", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "B", "H"};
int idx(string s)
{
for(int i=0; i<12; i++)
if(all[i] == s)
return i;
}
int main()
{
vector <string> s1(3);
cin>>s1[0]>>s1[1]>>s1[2];
sort(s1.begin(), s1.end());
do
{
int id1 = idx(s1[0]);
int id2;
for(int i=id1+1; i< 24; i++)
if(all[i] == s1[1])
{
id2 = i;
break;
}
int id3;
for(int i=id2+1; i< 24; i++)
if(all[i] == s1[2])
{
id3 = i;
break;
}
if((id2-id1 == 4) and (id3-id2 == 3))
{
cout<<"major";
return 0;
}
if((id2-id1 == 3) and (id3-id2 == 4))
{
cout<<"minor";
return 0;
}
}while(next_permutation(s1.begin(),s1.end()));
cout<<"strange";
return 0;
}