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 ...
随机推荐
- POJ 1129 Channel Allocation DFS 回溯
Channel Allocation Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 15546 Accepted: 78 ...
- ASP.NET--IIS的Http请求流程
下面的文章是基于IIS经典模式给出的流程图,和IIS集成模式有些区别,WIN7系统自带的是IIS7,和文章分写的有些区别,现在基本上都用IIS7了,所以不要入坑 伯乐在线的文章一 伯乐在线的文章二
- EntityFramework:状态变化与方法的关系[转载]
原文地址 一.约定 OnModelCreating 有一些限制需要注意,例如: 1.表名不支持使用标签进行标注 2.最小长度在 OnModelCreating 中不支持 3.正则表达式在 OnMode ...
- BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第12章节--SP 2013中远程Event Receivers 总结
BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第12章节--SP 2013中远程Event Receivers 总结 本章节向你介绍了SP平台上eve ...
- 分布式设计《初尝memcached》
之前听说过高性能的分布式缓存开源工具,但一直没有真正接触过,如今接触的产品中实用到过分布式缓存.所以决定一探到底.memcached是一个优秀的开源的分布式缓存工具.也是眼下比較火热的分布 ...
- luogu1313 计算系数
题目大意:给定一个多项式(ax+by)^k,请求出多项式展开后x^n*y^m 项的系数. 将原式化为(ax+by)*(ax+by)*...①,然后将其拆解,拆解时x乘了多少次,a就乘了多少次,y,b同 ...
- 一个简单的演示用的Linux字符设备驱动程序
实现如下的功能:--字符设备驱动程序的结构及驱动程序需要实现的系统调用--可以使用cat命令或者自编的readtest命令读出"设备"里的内容--以8139网卡为例,演示了I/O端 ...
- hdoj---Rescue
Rescue Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submis ...
- 10.2 Hibernate持久层
点击项目右键->MyEclipse->Add Hibernate Capabilities 打开MyEclipse Hibernate Perspective(MyEclipse Hibe ...
- linux IPtable防火墙 禁止和开放端口(转)
linux IPtable防火墙 禁止和开放端口源:http://hi.baidu.com/zplllm/item/f910cb26b621db57c38d5983评: 1.关闭所有的 INPUT F ...