CF88A.Chord
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Vasya studies music.
He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C stands H. We will consider the C note in the row's beginning and the C note after the H similar and we will identify them with each other. The distance between the notes along the musical scale is measured in tones: between two consecutive notes there's exactly one semitone, that is, 0.5 tone. The distance is taken from the lowest tone to the uppest one, that is, the distance between C and E is 4 semitones and between E and C is 8 semitones
Vasya also knows what a chord is. A chord is an unordered set of no less than three notes. However, for now Vasya only works with triads, that is with the chords that consist of exactly three notes. He can already distinguish between two types of triads — major and minor.
Let's define a major triad. Let the triad consist of notes X, Y and Z. If we can order the notes so as the distance along the musical scale between X and Y equals 4 semitones and the distance between Y and Z is 3 semitones, then the triad is major. The distance between X and Z, accordingly, equals 7 semitones.
A minor triad is different in that the distance between X and Y should be 3 semitones and between Y and Z — 4 semitones.
For example, the triad "C E G" is major: between C and E are 4 semitones, and between E and G are 3 semitones. And the triplet "C# B F" is minor, because if we order the notes as "B C# F", than between B and C# will be 3 semitones, and between C# and F — 4 semitones.
Help Vasya classify the triad the teacher has given to him.
瓦西娅在学习音乐。
他学到了许多有趣的知识。例如,他知道一共有 12 个音符:C、C#、D、D#、E、F、F#、G、G#、A、B、H。他还知道这些音符按循环方式重复:H 之后是 C,C 之前是 H。我们将把序列开头的 C 与 H 后面的 C 视为相同,并将它们等同起来。音阶上两个音符之间的距离以“全音”为单位来度量:相邻两个音符之间恰好相差一个半音,即 0.5 全音。该距离总是从较低音高向较高音高计算,因此 C 到 E 的距离为 4 个半音,而 E 到 C 的距离则为 8 个半音。
瓦西娅还了解什么是和弦。和弦是一个无序的音符集合,且至少包含三个音符。但目前瓦西娅只研究三和弦(triad),即恰好由三个音符组成的和弦。他已能区分两种三和弦——大三和弦(major triad)与小三和弦(minor triad)。
我们来定义大三和弦。设三和弦由音符 X、Y 和 Z 组成。若可将这三个音符排序,使得音阶上 X 到 Y 的距离为 4 个半音,且 Y 到 Z 的距离为 3 个半音,则该三和弦为大三和弦。相应地,X 到 Z 的距离为 7 个半音。
小三和弦的区别在于:X 到 Y 的距离应为 3 个半音,而 Y 到 Z 的距离应为 4 个半音。
例如,三和弦 “C E G” 是大三和弦:C 到 E 为 4 个半音,E 到 G 为 3 个半音;而三音组 “C# B F” 是小三和弦,因为若将音符排序为 “B C# F”,则 B 到 C# 为 3 个半音,C# 到 F 为 4 个半音。
请帮助瓦西娅判断老师给出的三和弦属于哪一类。
输入格式
The only line contains 3 space-separated notes in the above-given notation.
唯一的一行包含 3 个用上述记号表示的、以空格分隔的音符。
输出格式
Print "major" if the chord is major, "minor" if it is minor, and "strange" if the teacher gave Vasya some weird chord which is neither major nor minor. Vasya promises you that the answer will always be unambiguous. That is, there are no chords that are both major and minor simultaneously.
如果和弦为大三和弦,输出 "major";如果为小三和弦,输出 "minor";如果老师给瓦夏的是既非大三和弦也非小三和弦的“奇怪”和弦,则输出 "strange"。瓦夏向你保证答案总是明确无误的,即不存在同时既是大三和弦又是小三和弦的和弦。
输入输出样例
输入#1
C E G
输出#1
major
输入#2
C# B F
输出#2
minor
输入#3
A B H
输出#3
strange
输入解题思路,AI测评打分。不知道怎么写?