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

    A Famous Music Composer

    时间限制:1000 ms  |  内存限制:65535 KB
    难度:1
     
    描述
    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

     让我告诉你你WA的原因:

     printf("Case %d: ",sign++);

    "Case 1: "冒号后面还有个空格。
     1 #include <stdio.h>
     2 #include <string.h>
     3 int main()
     4 {
     5     char s1[10],s2[10];
     6     int sign = 1;
     7     while(scanf("%s%s",s1,s2) != EOF)
     8     {   
     9         printf("Case %d: ",sign++);
    10         if(!strcmp(s1,"A#")) printf("%s %s
    ","Bb",s2);
    11         else if(!strcmp(s1,"Bb")) printf("%s %s
    ","A#",s2);
    12         else if(!strcmp(s1,"C#")) printf("%s %s
    ","Db",s2);
    13         else if(!strcmp(s1,"Db")) printf("%s %s
    ","C#",s2);
    14         else if(!strcmp(s1,"D#")) printf("%s %s
    ","Eb",s2);
    15         else if(!strcmp(s1,"Eb")) printf("%s %s
    ","D#",s2);
    16         else if(!strcmp(s1,"F#")) printf("%s %s
    ","Gb",s2);
    17         else if(!strcmp(s1,"Gb")) printf("%s %s
    ","F#",s2);
    18         else if(!strcmp(s1,"G#")) printf("%s %s
    ","Ab",s2);
    19         else if(!strcmp(s1,"Ab")) printf("%s %s
    ","G#",s2);
    20         else printf("UNIQUE
    ");
    21     }
    22 }
  • 相关阅读:
    SqlServer事务语法及使用方法
    mysql解决自动断开8小时未曾用过的链接
    JIRA license申请和语言包下载
    String literal is not properly closed by
    android开发 NDK 动态链接多个第三方库(so)
    vim字符串替换
    VMware tools的用途及安装[跨系统文件拖拽]
    十大高明的Google搜索技巧
    安装ADT-20.0.3的时候产生org.eclipse.cdt.feature.group 0.0.0' but it could not be ..
    [Android NDK]修复/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory 问题
  • 原文地址:https://www.cnblogs.com/ljwTiey/p/4305140.html
Copyright © 2011-2022 走看看