NYOJ 题目25 A Famous Music Composer
来源:互联网 发布:bbs论坛数据库设计 编辑:程序博客网 时间:2024/05/29 13:39
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
- 注意输出还有空格!!! case(空格)i:(空格)%s(空格)%s
#include <stdio.h>#include <string.h>char s1[10],s2[10];int main (void){ // freopen("题目25.txt","r",stdin); int n,i=1; while(scanf("%s %s",s1,s2)!=EOF) { getchar(); printf("Case %d: ",i++); if(strcmp(s1,"A#")==0||strcmp(s1,"Bb")==0) printf("%s %s\n",(strcmp(s1,"A#")==0)?"Bb":"A#",s2); else if(strcmp(s1,"C#")==0||strcmp(s1,"Db")==0) printf("%s %s\n",(strcmp(s1,"C#")==0)?"Db":"C#",s2); else if(strcmp(s1,"D#")==0||strcmp(s1,"Eb")==0) printf("%s %s\n",(strcmp(s1,"D#")==0)?"Eb":"D#",s2); else if(strcmp(s1,"F#")==0||strcmp(s1,"Gb")==0) printf("%s %s\n",(strcmp(s1,"F#")==0)?"Gb":"F#",s2); else if(strcmp(s1,"G#")==0||strcmp(s1,"Ab")==0) printf("%s %s\n",(strcmp(s1,"G#")==0)?"Ab":"G#",s2); else printf("UNIQUE\n"); } return 0;}
0 0
- NYOJ 题目25 A Famous Music Composer
- NYOJ 25 A Famous Music Composer
- NYOJ A Famous Music Composer 25
- nyoj 25 A Famous Music Composer
- nyoj 25 A Famous Music Composer
- NYOJ --25--A Famous Music Composer
- 【NYOJ】[25]A Famous Music Composer
- NYOJ:25-A Famous Music Composer
- 南阳题目25-A Famous Music Composer
- 题目25 A Famous Music Composer
- 题目25-A Famous Music Composer
- NYOJ - A Famous Music Composer
- NYOJ A Famous Music Composer
- 25 A Famous Music Composer
- 25 A Famous Music Composer
- hdu 4245 nyoj 25 A Famous Music Composer
- NYOJ 25 A Famous Music Composer【英语题+暴力】
- nyoj.25 A Famous Music Composer【水题】 2015/03/15
- NanShan 如何解决DotProject中文乱码问题
- 五个字乘以4等于倒过来的值,四个字乘以4等于倒过来的值
- JavaBean的简单用法
- BZOJ 1786: [Ahoi2008]Pair 配对 题解
- 公历转农历的程序(代码转载于网络)
- NYOJ 题目25 A Famous Music Composer
- LNK2019,LNK1120一个可能编译时产生函数声明与实现不对称的误导提示信息的问题
- AJAX
- 忙碌与黑色的六月-告别我的青春
- 解决 软件包 org.cocos2dx.lib 不存在
- 一个职场人的素养--但求问心无愧
- Plugins (Pro/Mobile-Only Feature)
- SQL Server中的查询
- win8.1 下 eclipse+android 开发环境配置带图详细教程