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 }
  • 相关阅读:
    前后端不分离的springboot项目问题:页面框架问题
    SpringBoot使用Filter过滤器处理是否登录的过滤时,用response.sendRedirect()转发报错
    mysql千万级数据优化查询
    java进阶学习的一些思路
    java的List列表转成Tree(树形)结构列表
    cmd 一键获取 所有连接过的wifi 密码
    SQLMap用户手册【超详细】
    Python:SQLMAP参数中文解释
    初识sql注入及sqlmap
    wwwscan网站目录文件批量扫描工具
  • 原文地址:https://www.cnblogs.com/ljwTiey/p/4305140.html
Copyright © 2011-2022 走看看