nyoj_25 A Famous Music Composer
来源:互联网 发布:2017年留守儿童数据 编辑:程序博客网 时间:2024/06/13 03:49
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#=DbD D#=Eb E F F#=Gb G G#=AbFive 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# majorA# minor C# major Db minor D# major D# minorGb major Gb minor G# majorWrite 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 minorD# majorG minor
- 样例输出
Case 1: G# minorCase 2: Eb majorCase 3: UNIQUE
题意:
只要在第一个表里有2个名字的,都换成另外一个;如果只有一个名字,则输出UNIQUE。
分析:
暴力解决。
代码:
#include<stdio.h>#include<string.h>char s1[10],s2[10];int main(){int t=1;while(~scanf("%s%s",s1,s2)){printf("Case %d: ",t++);if(!strcmp(s1,"A#"))printf("Bb %s",s2);else if(!strcmp(s1,"Bb"))printf("A# %s",s2);else if(!strcmp(s1,"C#"))printf("Db %s",s2);else if(!strcmp(s1,"Db"))printf("C# %s",s2);else if(!strcmp(s1,"D#"))printf("Eb %s",s2);else if(!strcmp(s1,"Eb"))printf("D# %s",s2);else if(!strcmp(s1,"F#"))printf("Gb %s",s2);else if(!strcmp(s1,"Gb"))printf("F# %s",s2);else if(!strcmp(s1,"G#"))printf("Ab %s",s2);else if(!strcmp(s1,"Ab"))printf("G# %s",s2);elseprintf("UNIQUE");printf("\n");}return 0;}
0 0
- nyoj_25 A Famous Music Composer
- A Famous Music Composer
- A famous music composer
- A Famous Music Composer
- A Famous Music Composer
- A Famous Music Composer
- A Famous Music Composer
- A Famous Music Composer
- A Famous Music Composer
- A Famous Music Composer
- A Famous Music Composer(map)
- NYOJ - A Famous Music Composer
- 25 A Famous Music Composer
- HDU4245:A Famous Music Composer
- NYOJ25 A Famous Music Composer
- NY25 A Famous Music Composer
- 25 A Famous Music Composer
- HDU4245 A Famous Music Composer
- C#OOP之十 异常机制及其处理
- iosGCD用法
- UILabel UIButton 混合问题 -iOS初学
- 对于<welcome-file-list>设置主页后无法引用CSS的问题
- 用Hibernate框架把hql生成可执行的sql语句-Oracle方言
- nyoj_25 A Famous Music Composer
- Android Studio安装过程问题汇总
- Hibernate原生SQL查询使用addScalar()或addEntity()
- 要写易删除,而不易扩展的代码
- android基础学习之popupwindow
- 小何讲进程: Linux进程的基本概念
- java通过SMTP发送QQ邮件的完全步骤
- javascript双等号引起的类型转换,js隐性类型转换步骤
- 基于unity的飞行模拟设计