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 ...
随机推荐
- mysql show processlist
- webdriver API中文文档
1.1 下载selenium2.0的lib包 http://code.google.com/p/selenium/downloads/list 官方UserGuide:http://seleniu ...
- Less 的使用
Less 的使用 开发时直接使用 引用你的样式文件(main.less) (必须在less.min.js) 前引用 引用less.min.js 文件 <link href="resou ...
- BOM浏览器对象模型下面几个比较实用的方法
location对象 location.href-- 返回或设置当前文档的URL location.search -- 返回URL中的查询字符串部分.例如 http://www.dreamdu.com ...
- ps命令学习笔记
最近在看linux优化大师这本书,第2章祥细讲解了分析系统用的工具,这里把一些内容整理出来,以便加深印像. 当进行系统分析时,ps命令显示有关选择的活跃进程的信息.ps命令提供当前已存在的进程列表,和 ...
- CISCO2960配置vlan
一.VTP配置 1.VLAN database 2.(VLAN)#vtp domain wx 3.(VLAN)#vtp server 二.VLAN配置 1.VLAN database 2.(VLAN) ...
- JavaScript一个cookie存储的类
所有输出都在浏览器的控制台中 <script type="text/javascript"> /** * cookieStorage.js * 本类实现像localSt ...
- Maven基础
Maven基础 maven核心内容:依赖管理. Maven是Apache组织的开源项目,是项目构建工具.用来管理jar包之间的相互依赖关系 Maven是一个项目构建和管理的工具,提供了帮助管理,构建, ...
- 学习java窗口基本操作时无聊写的
学习java窗口基本操作时无聊写的 就当记录 代码如下: package day08; import java.awt.BorderLayout;import java.awt.Color;impor ...
- Html table 合并单元格
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...