A Famous Music Composer, famouscomposer

Source: Internet
Author: User

A Famous Music Composer, famouscomposer

/* Description: Mr. B is a famous music composer. one of his most famous work was his set of preludes. these 24 pieces span the 24 musical keys (there are musically distinct 12 scale notes, and each may use major or minor tonality ). the 12 distinct scale notes are: A # = Bb B c # = Db D # = Eb e f # = Gb G # = AB Five of the notes have two alternate names, as is indicated above with equals sign. thus, there are 1 7 possible names of scale notes, but only 12 musically distinct notes. when using one of these as the keynote for a musical key, we can further distinguish between major and minor tonalities. this gives 34 possible keys, of which 24 are musically distinct. in naming his preludes, Mr. B used all the keys t the following 10, which were named instead by their alternate names: AB minor A # major # Minor C # major Db minor D # major D # minor Gb major Gb minor G # major Write a program that, given the name of a key, give an alternate name if it has one, or report the key name is unique. enter Each test case is described by one line having the format "note tonality", where "note" is one of the 17 names for the scale notes given above, and "tonality" is either "major" or "minor" (quotes for clarify ). Output For each case output the required answer, following the format of the sample. input AB minor D # major G minor sample output Case 1: G # minor Case 2: Eb major Case 3: UNIQUE * // * AB minorCase 1: G # minorD # majorCase 2: Eb majorG minorCase 3: UNIQUE */# include <stdio. h> # include <string. h> int main (int argc, const char * argv []) {// insert code here... char s1 [10], s2 [10]; int sign = 1; while (scanf ("% s", s1, s2 )! = EOF) {printf ("Case % d:", sign ++); if (! Strcmp (s1, "A #") printf ("% s \ n", "Bb", s2); else if (! Strcmp (s1, "Bb") printf ("% s \ n", "A #", s2); else if (! Strcmp (s1, "C #") printf ("% s \ n", "Db", s2); else if (! Strcmp (s1, "Db") printf ("% s \ n", "C #", s2); else if (! Strcmp (s1, "D #") printf ("% s \ n", "Eb", s2); else if (! Strcmp (s1, "Eb") printf ("% s \ n", "D #", s2); else if (! Strcmp (s1, "F #") printf ("% s \ n", "Gb", s2); else if (! Strcmp (s1, "Gb") printf ("% s \ n", "F #", s2); else if (! Strcmp (s1, "G #") printf ("% s \ n", "AB", s2); else if (! Strcmp (s1, "AB") printf ("% s \ n", "G #", s2); else printf ("UNIQUE \ n ");} return 0 ;}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.