NYOJ 25 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
让我告诉你你WA的原因:
printf("Case %d: ",sign++);
"Case 1: "冒号后面还有个空格。
#include <stdio.h>
#include <string.h>
int main()
{
char s1[],s2[];
int sign = ;
while(scanf("%s%s",s1,s2) != EOF)
{
printf("Case %d: ",sign++);
if(!strcmp(s1,"A#")) printf("%s %s\n","Bb",s2);
else if(!strcmp(s1,"Bb")) printf("%s %s\n","A#",s2);
else if(!strcmp(s1,"C#")) printf("%s %s\n","Db",s2);
else if(!strcmp(s1,"Db")) printf("%s %s\n","C#",s2);
else if(!strcmp(s1,"D#")) printf("%s %s\n","Eb",s2);
else if(!strcmp(s1,"Eb")) printf("%s %s\n","D#",s2);
else if(!strcmp(s1,"F#")) printf("%s %s\n","Gb",s2);
else if(!strcmp(s1,"Gb")) printf("%s %s\n","F#",s2);
else if(!strcmp(s1,"G#")) printf("%s %s\n","Ab",s2);
else if(!strcmp(s1,"Ab")) printf("%s %s\n","G#",s2);
else printf("UNIQUE\n");
}
}
NYOJ 25 A Famous Music Composer的更多相关文章
- 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 ...
- nyoj 25-A Famous Music Composer(字符串)
25-A Famous Music Composer 内存限制:64MB 时间限制:1000ms Special Judge: No accepted:4 submit:9 题目描述: Mr. B i ...
- 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 ...
- nyoj25-A Famous Music Composer
A Famous Music Composer 时间限制:1000 ms | 内存限制:65535 KB 难度:1 描述 Mr. B is a famous music composer. One ...
- 【南阳OJ分类之语言入门】80题题目+AC代码汇总
小技巧:本文之前由csdn自动生成了一个目录,不必下拉一个一个去找,可通过目录标题直接定位. 本文转载自本人的csdn博客,复制过来的,排版就不弄了,欢迎转载. 声明: 题目部分皆为南阳OJ题目. 代 ...
- 南阳oj水题集合,语言的灵活运用
a+b 输入 输入两个数,a,b 输出 输出a+b的值 样例输入 2 3 样例输出 5 c/c++ #include<iostream> using namespace std; int ...
- nyoj 484-The Famous Clock
484-The Famous Clock 内存限制:64MB 时间限制:1000ms 特判: No 通过数:2 提交数:2 难度:1 题目描述: Mr. B, Mr. G and Mr. M are ...
- NYOJ-79 拦截导弹 AC 分类: NYOJ 2014-01-01 23:25 167人阅读 评论(0) 收藏
#include<stdio.h> int main(){ int num[1000]={0}; int n,m,x,y; scanf("%d",&n); wh ...
随机推荐
- 【Android Developers Training】 100. 使用Intent修改联系人数据
注:本文翻译自Google官方的Android Developers Training文档,译者技术一般,由于喜爱安卓而产生了翻译的念头,纯属个人兴趣爱好. 原文链接:http://developer ...
- python3中socket套接字的编码问题解决
一.TCP 1.tcp服务器创建 #创建服务器 from socket import * from time import ctime #导入ctime HOST = '' #任意主机 PORT = ...
- tomcat7以上,ajax post参数后台获取不到的问题
AJAX post传参后台获取不到查询参数. 网上找了各种方法,包括设置content-type,又是把json转成json格式字符串,问题依然存在,但是把post改成get又可以获取到,百思不得其解 ...
- .NET C#到Java没那么难,MVC篇
最典型的JAVA MVC就是JSP + servlet + javabean的模式.比较好的MVC,老牌的有Struts.Webwork.新兴的MVC 框架有Spring MVC.Tapestry.J ...
- peoplesoft function PSTREENODE 通过 deptid 获得部门树 一级部门 名称
create or replace function ht_gettopdeptNAME(deptid in varchar) return varchar2 is r ); c int; m ); ...
- Java 多态透析 详细理解
1:什么是多态 一个对象的多种状态 (老师)(员工)(儿子) 教师 a =老钟; 员工 b =老钟; 2:多态体现 父类引用变量指向了子类的对象 Father f = new Son ...
- Luogu 1962 斐波那契数列(矩阵,递推)
Luogu 1962 斐波那契数列(矩阵,递推) Description 大家都知道,斐波那契数列是满足如下性质的一个数列: f(1) = 1 f(2) = 1 f(n) = f(n-1) + f(n ...
- 【一步一步】Spring 源码环境搭建
平时项目中基本上都会用到spring,但是源码还没有深入的了解过.趁这段时间稍微空闲点,开始研究下spring 源码.下面是spring 源码的环境搭建. 主要分为如下步骤: ①安装jdk,gradl ...
- JMeter 监控和记录&常用功能
使用https连接时,如果对应站点的CA 证书错误,会直接报连接不到服务器的错误,org.apache.commons.httpclient.NoHttpResponseException,把错误证书 ...
- 认识cpu、核与线程
作为一个后台开发人员,我想有必要了解这些基础知识.如果本文有不严谨或者疏忽的地方,请指正. cpu与核心 物理核 物理核数量=cpu数(机子上装的cpu的数量)*每个cpu的核心数 虚拟核 所谓的4核 ...