Pro.ID21175 TitleGetting Chorded Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21175 AC0 Submit0 Ratio- 时间&空间限制描述The "names" of the notes on a standard 88-key piano keyboard start with A (the
lowest note on the keyboard) and then proceed sequentially with A# (A-sharp), B,
C, C#, D, D#, E, F, F#, G, and finally G#. After the first 12 notes are named,
the pattern repeats, proceeding through the last key, which is named C. Some
notes have other common names. A# may also be called B (B-flat), C# may be called D,
D# may be called E,
F# may be called G,
and G# may be called A.
(There are still other names, like C##, but we won't worry about those here!) Most music includes chords, or groups of notes played at the same time. Many of these chords are given standard names. For example, the notes C, E, and G sounded together are called a C Major chord. While the particular C, E and G in the chord are frequently close together on the keyboard, for our purposes here, any C, E, and G played at the same time will constitute a C Major chord. It is the spacing between the notes on the keyboard that distinguishes a Major chord from others. As you can see, there are exactly three notes skipped between the C and the E (namely C#, D and D#), and then only two skipped between the E and the G (namely F and F#). If we start with a different note, say F#, we can easily tell that the notes in an F Major chord are F, A, and C (skipping G, G#, and A between F# and A#, and skipping B and C between A# and C#). Another frequently encountered chord is the Minor chord. C Minor, for example, is played by sounding C, D#, and G. As you can see, C# and D are skipped between C and D#, and E, F and F# are skipped between D# and G. You should now be able to tell that the notes in an F# Minor chord are F#, A, and C#. In this problem you will be presented with a sequence of lines, each
containing the names of three notes. You are to identify if these three notes,
taken together, form a Major or Minor chord. If they do, you will display the
name of the chord. If they don't you'll also report that fact. Remember that the
notes need not appear in the usual sequence. Case will be ignored in the input,
and the symbol will be indicated by the letter 输入输出Description The "names" of the notes on a standard 88-key piano keyboard start with A (the
lowest note on the keyboard) and then proceed sequentially with A# (A-sharp), B,
C, C#, D, D#, E, F, F#, G, and finally G#. After the first 12 notes are named,
the pattern repeats, proceeding through the last key, which is named C. Some
notes have other common names. A# may also be called B (B-flat), C# may be called D,
D# may be called E,
F# may be called G,
and G# may be called A.
(There are still other names, like C##, but we won't worry about those here!) Most music includes chords, or groups of notes played at the same time. Many of these chords are given standard names. For example, the notes C, E, and G sounded together are called a C Major chord. While the particular C, E and G in the chord are frequently close together on the keyboard, for our purposes here, any C, E, and G played at the same time will constitute a C Major chord. It is the spacing between the notes on the keyboard that distinguishes a Major chord from others. As you can see, there are exactly three notes skipped between the C and the E (namely C#, D and D#), and then only two skipped between the E and the G (namely F and F#). If we start with a different note, say F#, we can easily tell that the notes in an F Major chord are F, A, and C (skipping G, G#, and A between F# and A#, and skipping B and C between A# and C#). Another frequently encountered chord is the Minor chord. C Minor, for example, is played by sounding C, D#, and G. As you can see, C# and D are skipped between C and D#, and E, F and F# are skipped between D# and G. You should now be able to tell that the notes in an F# Minor chord are F#, A, and C#. In this problem you will be presented with a sequence of lines, each
containing the names of three notes. You are to identify if these three notes,
taken together, form a Major or Minor chord. If they do, you will display the
name of the chord. If they don't you'll also report that fact. Remember that the
notes need not appear in the usual sequence. Case will be ignored in the input,
and the symbol will be indicated by the letter Input Output Sample Input C E G
C E F#
G C E
C Eb G
c# a f#
f g# C Sample Output C E G is a C Major chord.
C E F# is unrecognized.
G C E is a C Major chord.
C Eb G is a C Minor chord.
c# a f# is a F# Minor chord.
f g# C is a F Minor chord. Source 样例输入C E G
C E F#
G C E
C Eb G
c# a f#
f g# C 样例输出C E G is a C Major chord.
C E F# is unrecognized.
G C E is a C Major chord.
C Eb G is a C Minor chord.
c# a f# is a F# Minor chord.
f g# C is a F Minor chord. 作者 |