RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00258

Ljestvica

Unrated 레이팅 미적용
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(5^{th}\) round, February \(16^{th}\), 2013

Veronica attends a music academy. She was given a music sheet of a composition with only notes
(without annotations), and needs to recognise the scale used. In this problem, we will limit ourselves to
only the two most frequently used (and usually taught in schools first) scales: \(A-mi\)nor and \(C-ma\)jor.
This doesn't make them simpler or more basic than other minor and major scales – all minor scales are
mutually equivalent save for translation, and so are major scales.
Still, out of the 12 tones of an octave {A, A#, B, C, C#, D, D#, E, F, F#, G, G#} used in modern
music1, \(A-mi\)nor and \(C-ma\)jor scales do use the tones with shortest names: \(A-mi\)nor is defined as an
ordered septuple (A, B, C, D, E, F, G), and \(C-ma\)jor as (C, D, E, F, G, A, B).
Notice that the sets of tones of these two scales are equal. What's the difference? The catch is that not
only the set of tones, but also their usage, determines a scale. Specifically, the tonic (the first tone of a
scale), subdominant (the fourth tone) and dominant (the fifth tone) are the primary candidates for
accented tones in a composition. In \(A-mi\)nor, these are A, D, and E, and in \(C-ma\)jor, they are C, F, and
G. We will name these tones main tones.
Aren't the scales still equivalent save for translation? They are not: for example, the third tone of A-
minor (C) is three ha\(lf-to\)nes higher than the tonic (A), while the third tone of \(C-ma\)jor (E) is four half-
tones higher than the tonic (C). The difference, therefore, lies in the intervals. This makes minor scales
“sad” and major scales “happy”.
Write a program to decide if a composition is more likely written in \(A-mi\)nor or \(C-ma\)jor by counting
whether there are more main tones of \(A-mi\)nor or of \(C-ma\)jor among the accented tones (the first
tones in each measure). If there is an equal number of main tones, determine the scale based on the
last tone (which is guaranteed to be either A for \(A-mi\)nor or C for \(C-ma\)jor in any such test case).
For example, examine the we\(ll-kn\)own melody “Frère Jacques”^{2}:
CD|EC|CD|EC|EF|G|EF|G|GAGF|EC|GAGF|EC|CG|C|CG|C
The character “|” separates measures, so the accented tones are, in order: C, E, C, E, E, G, E, G, G, E,
G, E, C, C, C, C. Ten of them (C, C, G, G, G, G, C, C, C, C) are main tones of \(C-ma\)jor, while six (E,
E, E, E, E, E) are main tones of \(A-mi\)nor. Therefore, our best estimate is that the song was written in
\(C-ma\)jor.

제약
입력 형식

The first and only line of input contains a sequence of at least 5, and at most 100, characters from the
set {“A”, “B”, “C”, “D”, “E”, “F”, “G”, “|”}. This is a simplified notation for a composition, where
the character “|” separates measures. The characters “|” will never appear adjacent to one another, at
the beginning, or at the end of the sequence.

출력 형식

The first and only line of output must contain the text “\(C-du\)r” (for \(C-ma\)jor) or “\(A-mo\)l” (for A-
minor).

1
This is the international, more consistent notation. In Croatia, the German notation is usually used, where A# (or Bb) is
renamed to B, and B is renamed to H.
2
"Are You Sleeping?" in English; "Bratec Martin" in Croatian.
\(5^{th}\) round, February \(16^{th}\), 2013

예제 1
입력
AEB|C
출력
C-dur
예제 2
입력
CD|EC|CD|EC|EF|G|EF|G|GAGF|EC|GAGF|EC|CG|C|CG|C
출력
C-dur
문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2012/2013 Contest 5

평가 및 의견

Ljestvica

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Ljestvica

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8