题目25-A Famous Music Composer
来源:互联网 发布:maven java目录下的xml 编辑:程序博客网 时间:2024/06/13 04:44
A Famous Music Composer
- 描述
- 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
//字符替换
#include<stdio.h>int main(){ int i=0; char a[30],b[30]; while(scanf("%s%s",a,b)!=EOF) { i++; if(a[1]=='#') { a[0]=(a[0]-'A'+1)%7+'A'; a[1]='b'; } else if(a[1]=='b') { a[0]=(a[0]-'A'+6)%7+'A'; a[1]='#'; } else { printf("Case %d: UNIQUE\n",i); continue; } printf("Case %d: %s %s\n",i,a,b); } return 0;}
阅读全文
0 0
- NYOJ 题目25 A Famous Music Composer
- 南阳题目25-A Famous Music Composer
- 题目25 A Famous Music Composer
- 题目25-A Famous Music Composer
- 25 A Famous Music Composer
- 25 A Famous Music Composer
- 南阳oj 题目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
- NYOJ 25 A Famous Music Composer
- NYOJ A Famous Music Composer 25
- 洛谷 P2341 [HAOI2006]受欢迎的牛
- Kotlin 第十五章:高阶函数和 Lambda 表达式
- CodeForces 253D Table with Letters
- Mybatis——传单个参数和多个参数的方法
- Intellij IDEA 使得Web项目在Tomcat中部署运行
- 题目25-A Famous Music Composer
- 10:素数对( 1.12编程基础之函数与过程抽象)
- ROS学习之路
- 训练集---训练赛9
- 搜索策略及优化
- 【java基础】数组
- 飞思卡尔MC9S12(X)系列的内存资源分配和.prm文件的结构
- 计算1+2+3+.......+100的和
- 金秋杯联赛模拟第一场(day2)