hdu 42445A Famous Music Composer

A Famous Music Composer

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 460    Accepted Submission(s): 271


Problem 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:


Five of the notes have two alternate names, as is indicated above with equals sign. Thus, there are 17 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 except the following 10, which were named instead by their alternate names:


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.
 


 

Input
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.
 


 

Sample Input
   
   
   
   
Ab minor D# major G minor
 


 

Sample Output
   
   
   
   
Case 1: G# minor Case 2: Eb major Case 3: UNIQUE
 

A#=Bb  表示这2个串 可以互换

输入2个串 把第一个串换掉后输出 第二个直接输出   如果第一个换不掉  输出 UNIQUE

Source
Fudan Local Programming Contest 2012

 

#include<stdio.h>
#include<string.h>
struct haha
{
    char str1[10];
    char str2[10];
}a[20];


int main()
{
    int cas=0,i;
    char s1[100],s2[100];
    strcpy(a[1].str1,"A#");
    strcpy(a[1].str2,"Bb");
    strcpy(a[2].str1,"Bb");
    strcpy(a[2].str2,"A#");
    strcpy(a[3].str1,"C#");
    strcpy(a[3].str2,"Db");
    strcpy(a[4].str1,"Db");
    strcpy(a[4].str2,"C#");
    strcpy(a[5].str1,"D#");
    strcpy(a[5].str2,"Eb");
    strcpy(a[6].str1,"Eb");
    strcpy(a[6].str2,"D#");
    strcpy(a[7].str1,"F#");
    strcpy(a[7].str2,"Gb");
    strcpy(a[8].str1,"Gb");
    strcpy(a[8].str2,"F#");
    strcpy(a[9].str1,"G#");
    strcpy(a[9].str2,"Ab");
    strcpy(a[10].str1,"Ab");
    strcpy(a[10].str2,"G#");
   
    while(scanf("%s %s",s1,s2)!=EOF)
    {
         for(i=1;i<=10;i++)
         {
             if(strcmp(s1,a[i].str1)==0) break;
         }
         if(i>10) printf("Case %d: UNIQUE\n",++cas);
         else printf("Case %d: %s %s\n",++cas,a[i].str2,s2);
    }
 return 0;

}

你可能感兴趣的:(hdu 42445A Famous Music Composer)