2 shunfurh shunfurh 于 2017.09.05 15:42 提问

Major Scales

In music, the range of audible frequencies is divided into octaves, where each octave spans frequencies within factor of 2 of one another. For example, the note called middle C corresponds to an audio frequency of 263 Hz. The octave below middle C spans the frequency range from 131.5 Hz to 263 Hz while the octave above middle C spans the range from 263 Hz to 526 Hz.

An octave contains 13 chromatic notes whose frequencies differ by a common ratio. The separation between two adjacent chromatic notes is called a half-step or semi-tone. Note that there are 12 semi-tones in an octave and therefore the frequency ratio represented by a semi-tone is 1.0593 (since 1.0593^12 = 2). A tone is two semi-tones.
While it might be convenient to use frequencies to describe musical notes, historical tradition demands that we name the notes of the chromatic scale, in order: C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C, and so on, repeating the same names for each new octave.

Western music rarely uses all the notes in the chromatic scale. Instead, 8 of the 13 chromatic notes are commonly used a composition. The most common such set of 8 notes is the major scale. The 8 notes of a major scale, in order, are separated by: tone, tone, semi-tone, tone, tone, tone, semi-tone. A major scale can begin with any of the chromatic notes; this note defines the key of the scale. Coincidentally, in the key of C, the major scale consists of the notes: C, D, E, F, G, A, B, C. On the other hand, in the key of F, the major scale is: F, G, A, A#, C, D, E, F.

There are other scales, notably the minor scale, and music composed in a particular scale sometimes uses notes that are not within the scale, caled accidentals. We shall concern ourselves only with music composed in a major scale with no accidentals.

Your job is to read a sequence of notes and to identify all the keys that the music might have been composed in. Your program need not have any musical ear: report a particular key if and only if all the notes come from the major scale in that key.

Input

Input contains several test cases. Each test case consists of a single line of input, containing a sequence of chromatic notes separated by white space. No input line exceeds 1000 characters. The last line of input contains the word "END".

Output

For each test case, output a line giving the possible keys, in the order given above.

Sample Input

C C D F E G A A F G B
A B C D E F G C#
C C D F E G A A F G
C C C C C
END

Sample Output

C

C F
C C# D# F G G# A#

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.19 23:52
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
UVa 10528 - Major Scales
題目:鋼琴的半音符序列分為C,C#,D,D#,E,F,F#,G,G#,A,A#,B,12個音節為一個循環,             大調音節,由8个半音符構成,規則為:全音-全音-半音-全音-全音-全音-半音,可以從任何音節開始,             從哪裡開始就是什麼大調,例子如下:     C大调  :C D E F G A B C             C#大调:C# D# F
Node.js 8 the Right Way Practical, Server-Side JavaScript That Scales epub
Node.js 8 the Right Way Practical, Server-Side JavaScript That Scales 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
如何投影一个纹理 (翻译:心蓝 潘李亮)
  原文出处:SGI OpenGL 教程翻译:心蓝 潘李亮。 Email: Xheartblue@etang.com 译者前言:  影子有两种经典的实现方法:一是Shadow Volume 。二是Shadow Mapping。如何用Light Mapping来实现投影影子呢?这就要用到Project Texture.直接翻译的意思就是投
CodeForces 552C:Vanya and Scales【技巧】
C. Vanya and Scales time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya has a scales for weighing loads an
Linux内核Major,Minor和磁盘数的关系
Linux 内核使用静态的Major number和Minor number来进行SCSI设备的寻址,而系统为SCSI设备保留的Major和Minor是有个数限制的。所以根据可用的Major number不同,系统可支持的SCSI磁盘数量都有个数限制,不同的内核,支持的SCSI磁盘Major数量不一样。 对于Linux 2.4内核来讲,Major number数可以是128、256、2304,其
一篇论文又是Major Revision
今天一大早收到来自三个多月前投稿的一个journal的审稿回复:revise and reconsider。。。给老板看了具体的letter后觉得这就是Major Revision。 坑爹啊,这篇论文从去年4月正式开始立题,7月份第一次投出,10月份得到审稿意见,审稿意见挺不错,但需要修改,修改完后再投,审稿人都觉得可以了,但是editor就是不同意,还要推荐新审稿人,不得不按要求推荐了6个来自
Linux系统设备(device)的major和minor number
Linux系的/dev目录下面的的设备文件是用来表示外设的,如/dev/sda1表示第一块硬盘的第一个分区。但是这个/dev/sda1仅仅是方便用户观察,linux内核中表示不同的设备是通过major 和minor number实现的,通过major和minor Number来加载相应的驱动程序。 major number:表示不同的设备类型 minor number:表示同一个设备的的不同分
bug程度分析
此欄位描述 bug 的嚴重等級。(blocker,critical,major,normal,minor,trivial,enhancement)blocker     會擋掉所有開發中、測試中的工作critical     系統發生 crash 、資料遺失、嚴重的記憶體流失major     功能出現較大型的問題normal     功能出現一般的問題,在特定環境下某些功
关于major、minor的解释
我们知道,在Unix系系统中,一切皆是文件,所有硬盘,键盘,网卡等设备都有文件来代表,对应着/dev/下面的文件。对于应用程序来说,可以像对待普通文件一样打开,关闭,读写这些设备文件。但是,这种文件名比如:/dev/sda  、/dev/raw/raw1 都是用户空间名称,OS Kernel根本不知道这个名称代指什么。在内核空间是通过major、minor device number来区分设备的。
Scales
Farmer John has a balance for weighing the cows. He also has a set of N (1 <= N <= 1000) weights with known masses (all of which fit in 31 bits) for use on one side of the balance. He places a cow on