#P7644. Determine Musical Key
Determine Musical Key
Determine Musical Key
In this problem, you are given a musical score composed of several measures. We only consider two scales: A minor and C major.
The A minor scale is given by \(\{ A, B, C, D, E, F, G \}\) and the C major scale by \(\{ C, D, E, F, G, A, B \}\). For each scale, the primary notes are defined as the first, fourth, and fifth notes of the scale. That is, the primary notes for A minor are \(A, D, E\), and for C major they are \(C, F, G\).
To determine the key of the score:
- Examine the first note of each measure. If this note is one of the primary notes of A minor, increment the A minor count. Similarly, if it is one of the primary notes of C major, increment the C major count.
- The key of the score is the scale with the higher count.
- If both counts are equal, then the key is decided by the last note of the entire score. If the last note is \(A\), the score is in A minor; otherwise, it is in C major.
inputFormat
The input begins with an integer \(n\) (\(1 \le n \le 100\)) representing the number of measures. The following \(n\) lines each describe a measure with a sequence of space-separated notes. Each note is one of the seven letters: A, B, C, D, E, F, or G.
outputFormat
Output a single line: A minor if the score is in A minor, or C major if the score is in C major.
sample
3
A B C
C D E
D F A
A minor