A Famous Music Composer(南阳oj25)(一道无聊的英文题)

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
来源
hdu
上传者

李如兵

#include<stdio.h>
#include<string.h>
int main()
{
	char a[10],s[10];//数组开大点,否则不会过!破题。
	int kase=1;
	while(scanf("%s %s",a,s)!=EOF)
	{
		printf("Case %d: ",kase++);
		if(!strcmp(a,"A#")) printf("Bb %s\n",s);
		else if(!strcmp(a,"Bb")) printf("A# %s\n",s);
		else if(!strcmp(a,"C#")) printf("Db %s\n",s);
		else if(!strcmp(a,"Db")) printf("C# %s\n",s);
		else if(!strcmp(a,"D#")) printf("Eb %s\n",s);
		else if(!strcmp(a,"Eb")) printf("D# %s\n",s);
		else if(!strcmp(a,"F#")) printf("Gb %s\n",s);
		else if(!strcmp(a,"Gb")) printf("F# %s\n",s);
		else if(!strcmp(a,"G#")) printf("Ab %s\n",s);
		else if(!strcmp(a,"Ab")) printf("G# %s\n",s);
		else printf("UNIQUE\n");
	}
	return 0;
}
时间: 2024-10-23 02:08:52

A Famous Music Composer(南阳oj25)(一道无聊的英文题)的相关文章

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 ar

07-语言入门-07-A Famous Music Composer

题目地址: http://blog.csdn.net/sevenmit/article/details/8231994 描述 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

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

一道有趣的算法题。。。

题目意思: 用1, 2, 3 ,4 ,5, 6, 7, 8, 9 组成3个三位数 abc, def 和 ghi, 每个数字恰好使用一次,要求abc:def:ghi = 1:2:3.输出所有解. 分析: 模拟所有三位数,判断条件有二: 一.i(abc):j(def):k(ghi)=1:2:3 二.判断是否出现的1~9之间的所有数字 代码: /** *一道有趣的算法题 * */ #include<iostream> #include<cstdio> using namespace st

一道模板元编程题源码解答(replace_type)

今天有一同学在群上聊到一个比较好玩的题目(本人看书不多,后面才知是<C++模板元编程>第二章里面的一道习题), 我也抱着试一试的态度去完成它, 这道题也体现了c++模板元编程的基础和精髓: 类型就是数据. 题目如下所述: Write a ternary metafunction replace_type<c,x,y> that takes an arbitrary compound type c as its first parameter, and replaces all oc

一道有趣的算法题:仿照Excel的列编号,给定一个数字,输出该列编号字符串

       By Long Luo 最近遇到一个算法题: 仿照Excel的列编号,给出一个数字,输出该列编号字符串. 例如:A对应1,Z对应26,AA对应27,AZ对应52 ...... 这个题目是一个典型的26进制思路去处理,但是这个题目里面有很多陷阱,在1, 26, 52等特殊情况进行考虑,经过晚上接近1个小时的编写,完成的代码如下: C++代码如下: #include <iostream> #include <string.h> using namespace std; /

一道简单的数据结构题 栈的使用(括号配对)

一道简单的数据结构题 发布时间: 2017年6月3日 18:46   最后更新: 2017年6月3日 18:51   时间限制: 1000ms   内存限制: 128M 描述 如果插入"+"和"1"到一个括号序列,我们能得到一个正确的数学表达式,我们就认为这个括号序列是合法的.例如,序列"(())()", "()"和"(()(()))"是合法的,但是")(", "(()&quo

从一道简单的dp题中学到的...

今天想学点动态规划的知识,于是就看了杭电的课件,数塔问题啊,LCS啊都是比较经典的动规了,然后随便看了看就开始做课后练习题... HDOJ 1421 搬寝室 http://acm.hdu.edu.cn/showproblem.php?pid=1421 题目大意:从n(n <= 2000)个数中选出k对数(即2*k个),使它们的差的平方和最小. 例如:从8,1,10,9,9中选出2对数,要使差的平方和最小,则应该选8和9.9和10,这样最小,结果为2 因为知道是dp的题,先建个dp[][]数组,然

值得一做》关于一道DP+SPFA的题 BZOJ1003 (BZOJ第一页计划) (easy+)

这是一道数据范围和评测时间水的可怕的题,只是思路有点难想,BUT假如你的思路清晰,完全了解怎么该做,那就算你写一个反LLL和反SLE都能A,如此水的一道题,你不心动吗? 下面贴出题目 Description 物流公司要把一批货物从码头A运到码头B.由于货物量比较大,需要n天才能运完.货物运输过程中一般要转停好几个码头.物流公司通常会设计一条固定的运输路线,以便对整个运输过程实施严格的管理和跟踪.由于各种因素的存在,有的时候某个码头会无法装卸货物.这时候就必须修改运输路线,让货物能够按时到达目的地