nyoj 25 A Famous Music Composer
来源:互联网 发布:域名代理商哪个好 编辑:程序博客网 时间:2024/05/29 14:29
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
这道题只需把第一个表中相互对应的字母换一下,再输出就行了。比如C#需要换成Db(有=的),后面的不变输出,像A,B,C,D,E,F,G这个单个的,因为表中没有对应的(就是它们后面没有=的),就输出UNIQUE.
#include<stdio.h>#include<string.h>int main(){int n=1,i,l;char s[10];while(gets(s)){printf("Case %d: ",n++);l=strlen(s);if(s[1]==' ')printf("UNIQUE\n");else{if(s[1]=='#'){if(s[0]=='G'){s[0]='A';s[1]='b';}else{s[0]+=1;s[1]='b';}}else{if(s[0]=='A'){s[0]='G';s[1]='#';}else{s[0]-=1;s[1]='#';}}puts(s);}}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
- 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
- A Famous Music Composer
- A famous music composer
- A Famous Music Composer
- ExtJs 入门教程七[登陆窗体Demo:Login]
- ListView优化方案的几点解析
- hdu1892See you~
- LEETCODE: Restore IP Addresses
- 新的一年新的开始
- nyoj 25 A Famous Music Composer
- linux:关于Linux系统中 CPU Memory IO Network的性能监测
- C++使用默认参数
- POJ1679 The Unique MST【Kruskal】【次小生成树】
- Jquery<6>Jquery Ajax
- expdp/impdp 挂起处理
- 大家好 需要大家关注
- 参加java培训班一个月总结
- Atitit.线程 死锁 跑飞 的检测与自动解除 与手动解除死锁 java c# .net php javascript.