zoukankan      html  css  js  c++  java
  • A Famous Music Composer

    描述

    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     A#=Bb  B        C       C#=Db D       D#=Eb  E       F        F#=Gb  G       G#=Ab
     
    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: 
     Ab minor  A# major A# 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. 
    输入
    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).
    输出
    For each case output the required answer, following the format of the sample.
    样例输入
    Ab minor
    D# major
    G minor
    样例输出
    Case 1: G# minor
    Case 2: Eb major
    Case 3: UNIQUE
     1 #include <stdio.h>   //这道题开始做的时候是错的,但是重新做了一次又对了,真是郁闷,不知道错在哪里,其实这是一道非常简单的水题来的。。。
     2 #include <string.h>
     3 
     4 int main(){
     5     char s1[10];
     6     char s2[10];
     7     int time;
     8     
     9     time=1;
    10     
    11     while(scanf("%s%s",s1,s2)!=EOF){
    12         printf("Case %d: ",time);
    13         time++;
    14         
    15         if(strcmp(s1,"A#")==0)
    16             printf("%s %s
    ","Bb",s2);
    17             
    18         else if(strcmp(s1,"Bb")==0)
    19             printf("%s %s
    ","A#",s2);
    20             
    21         else if(strcmp(s1,"C#")==0)
    22             printf("%s %s
    ","Db",s2);
    23             
    24         else if(strcmp(s1,"Db")==0)
    25             printf("%s %s
    ","C#",s2);
    26             
    27         else if(strcmp(s1,"D#")==0)
    28             printf("%s %s
    ","Eb",s2);
    29             
    30         else if(strcmp(s1,"Eb")==0)
    31             printf("%s %s
    ","D#",s2);
    32             
    33         else if(strcmp(s1,"F#")==0)
    34             printf("%s %s
    ","Gb",s2);
    35             
    36         else if(strcmp(s1,"Gb")==0)
    37             printf("%s %s
    ","F#",s2);
    38             
    39         else if(strcmp(s1,"G#")==0)
    40             printf("%s %s
    ","Ab",s2);
    41         
    42         else if(strcmp(s1,"Ab")==0)
    43             printf("%s %s
    ","G#",s2);
    44             
    45         else
    46             printf("UNIQUE
    ");    
    47     }
    48     return 0;
    49 }
  • 相关阅读:
    nagios安装配置
    Nagios:企业级系统监控方案
    使用Maven搭建Struts2+Spring3+Hibernate4的整合开发环境
    SecureCRT最佳配色方法+直接修改默认配置方法
    highcharts插件使用总结和开发中遇到的问题及解决办法
    关于Highcharts图表组件动态修改属性的方法(API)总结之Series
    Linux中环境变量文件及配置
    使用正则表达式匹配任意字符包括空格和换行符
    设置mysql远程连接root权限
    java读取文件夹下所有文件并替换文件每一行中指定的字符串
  • 原文地址:https://www.cnblogs.com/zqxLonely/p/4095997.html
Copyright © 2011-2022 走看看