nyoj25-A Famous Music Composer
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#=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
#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;
}
#include<iostream>
#include<string>
using namespace std;
string trans(string a){
string b="";
if(a[1]=='#'){
b+=char((a[0]-'A'+1)%7+'A');
b+='b';
}else{
b+=char((a[0]-'A'+6)%7+'A');
b+='#';
}
return b;
}
int main(){
string a,b;
for(int t=1; cin>>a>>b; t++){
cout<<"Case "<<t<<": ";
if(a.length()==1)
cout<<"UNIQUE"<<endl;
else
cout<<trans(a)<<" "<<b<<endl;
}
return 0;
}
nyoj25-A Famous Music Composer的更多相关文章
- 07-语言入门-07-A Famous Music Composer
题目地址: http://blog.csdn.net/sevenmit/article/details/8231994 描述 Mr. B is a famous music composer. On ...
- A Famous Music Composer
描述 Mr. B is a famous music composer. One of his most famous work was his set of preludes. These 24 p ...
- NYOJ 25 A Famous Music Composer
A Famous Music Composer 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 Mr. B is a famous music composer. O ...
- nyoj 25-A Famous Music Composer(字符串)
25-A Famous Music Composer 内存限制:64MB 时间限制:1000ms Special Judge: No accepted:4 submit:9 题目描述: Mr. B i ...
- 25.A Famous Music Composer
描述 Mr. B is a famous music composer. One of his most famous work was his set of preludes. These 24 p ...
- 【南阳OJ分类之语言入门】80题题目+AC代码汇总
小技巧:本文之前由csdn自动生成了一个目录,不必下拉一个一个去找,可通过目录标题直接定位. 本文转载自本人的csdn博客,复制过来的,排版就不弄了,欢迎转载. 声明: 题目部分皆为南阳OJ题目. 代 ...
- 南阳oj水题集合,语言的灵活运用
a+b 输入 输入两个数,a,b 输出 输出a+b的值 样例输入 2 3 样例输出 5 c/c++ #include<iostream> using namespace std; int ...
- Laravel Composer and ServiceProvider
Composer and: 创建自定义类库时,按命名空间把文件夹结构组织好 composer.json>autoload>classmap>psr-4 composer dump-a ...
- 基于Composer Player 模型加载和相关属性设置
主要是基于达索软件Composer Player.的基础上做些二次开发. public class ComposerToolBarSetting { public bool AntiAliasingO ...
随机推荐
- 哈哈,找到一种方式来简单模拟EXTJS中与服务器的AJAX交互啦。
一直在测试客户端的EXTJS,但遇到服务器端就麻烦了,要建库,要写JSON,要有HTTP返回值. 今天测试了一个简单的方法,经过测试是OK了. 那,就是Python的SimpleHTTPServer模 ...
- GitHub分支项目不支持搜索问题解决:Sorry, forked repositories are not currently searchable.
错误如下: 在GitHub上的项目,如果是分支项目的星星数没有超过父项目,就不会去索引从而不会进行代码搜索. 解决方法: 1.要在搜索结果中包含分支,需要添加fork:true或fork:only查询 ...
- nginx中父子进程工作的主体函数
依据Nginx(0.7.67版本号)的代码.对Nginx主要的进程创建,进程主体以及事件处理进行了简要的分析. 基本上,父进程(即主进程)一開始会初始化及读取配置.并载入各模块的功能,然后fork() ...
- 启动BIOS虚拟化
启动BIOS虚拟化 学习了:https://jingyan.baidu.com/article/335530daa55d7e19cb41c3c2.html securable.exe下载地址:http ...
- 新安装的wampserver怎么使用本机已有的mysql作为数据库
一般在一台没有安装mysql的机器上安装好wamp后,能够直接在wamp的phpMyAdmin中打开集成的mysql并设置用户信息. 而假设之前已经安装配置好mysql(实usernamepasswo ...
- javascript基础篇--function类型(上)
在js中,function类型实际上是对象,每一个函数都是function类型的一个实例.并且与其它引用类型一样具有属性和方法. 声明 1普通方式 Function sum(num1,num2) { ...
- maven创建web报错failure to transfer org.codehaus.plexus
failure to transfer org.codehaus.plexus:plexus:pom:2.0.5 from http:// repo.maven.apache.org/maven2 w ...
- wpf Textbox 点击选中全部文本
用法:依赖属性 SelectTextOnFocus.Active = True public class SelectTextOnFocus : DependencyObject { public s ...
- SQL Server数据库 bcp导出备份文件应用
/** * 授权 */ EXEC sp_configure 'show advanced options',1; go reconfigure; go exec sp_configure 'xp_ ...
- idea的环境变量设置(Enviroment variables)