ZOJ Problem Set - 3401
The guitar is a plucked string instrument, played either with fingers or a pick. The guitar consists of a body with a rigid neck to which the strings, generally six in number.
Frets are metal strips (usually nickel alloy or stainless steel) embedded along the fretboard and located at exact points that divide the scale length in accordance with a specific mathematical formula. Pressing a string against a fret determines the strings' vibrating length and therefore its resultant pitch. The pitch of each consecutive fret is defined at a half-step interval on the chromatic scale.
Scales are typically listed from low to high. Most scales are octave-repeating, meaning their pattern of notes is the same in every octave. An octave-repeating scale can be represented as a circular arrangement of pitch classes, ordered by increasing pitch class. For instance, the increasing C major scale is, C-D-E-F-G-A-B-[C], with the bracket indicating that the last note is an octave higher than the first note. In scientific pitch notation, An octave-repeating scale C-D-E-F-G-A-B-[C] is written as Ci-Di-Ei-Gi-Ai-Bi-[Ci+1], i.e., if i = 4, it's C4-D4-E4-F4-G4-A4-B4-[C5]. The interval between two successive pitch is described in the pictures below, where HS = half-step and WS = whole-step:
Now, let's use a mathematical form to describe what was described above. In this problem, we define:
You should output the pitch you play using scientific pitch notation. See "Output" for more details.
There are multiple cases. In each case, there is one of two operations described above in a single line. A single number 0 in a single line indicates the end of the case. There is a blank line between two cases.
For each case, output the pitch you play using scientific pitch notation. If you can't use C D E F G A B to denote the pitch, add a symbol "#" after it, like C4#, D5# and etc., but E3# is forbidden because E3# = F3. Output every pitch in a single line. Output a blank line between two cases. All the cases contain at sleast two lines.
6 5 4 3 2 1 0 0 1 0 2 3 0 6 5 4 3 2 1 1 1 1 1 1 1 1 2 3 4 5 6 0
E3 A3 D4 G4 B4 E5 E3 C4 E4 G4 C5 E5 F5 C5 G4# D4# A3# F3
Author: YU, Xiaoyao
Contest: ZOJ Monthly, September 2010