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 ...
随机推荐
- thinkphp中try catch的运用
public function doedit_set(){ $info=$this->_post("info"); $id=$this->_post("id& ...
- create groups 和 create folder reference
当将文件拖入工程中的时候会出现这个对话框,这个对话框中在Added folders中有两种选择:Create groups 和 Create folder references 这两种的区别是 ...
- 【OGG】OGG基础知识整理
[OGG]OGG基础知识整理 一.GoldenGate介绍 GoldenGate软件是一种基于日志的结构化数据复制软件.GoldenGate 能够实现大量交易数据的实时捕捉.变换和投递,实现源数据库与 ...
- C# selecd,new,virtual,abstract与override
本文大部分内容摘自 <.NET开发专家·亮剑.NET : .NET深入体验与实战精要> 博主只是搬运工,不喜勿喷. 关于虚方法,抽象类这一部分一直不是太清楚,目前的工作中也接触不到这些. ...
- 快速查询List中指定的数据
时间:2017/5/15 作者:李国君 题目:快速查询List中指定的数据 背景:当List中保存了大量的数据时,用传统的方法去遍历指定的数据肯定会效率低下,有一个方法就是类似于数据库查询那样,根据索 ...
- 集合用法笔记-Map用法
一.Map遍历 Map<String, String> map = new HashMap<String, String>(); map.put("1", ...
- JAVA金额按比例分摊,零头处理
金额精确计算,必须使用BigDecimal; 平均分摊,分摊的零头,一般都是由数据"精度"和分摊系数决定的: 主要是如何对零头进行处理,保证尽可能的平均分配. 1.按户均摊 /** ...
- BootLoader--改进(基于2440)
BootLoader--改进 之前编写的Bootloader启动内核时间使用差不多7秒钟的时间,大多都是用在CPU将内核从Nandflash读取到SDRam中,故首先想到的方法是改变CPU时钟频率. ...
- mac重开电脑后显示重装提示解决办法
情况描述: mac昨天电脑关闭后 第二天打开电脑就显示语言选择安装语言 解决办法: 1 出现语言安装提示界面 我们选择简体中文 2 出现苹果密码登陆 我们选择下面的按钮点击退出 这样就可 ...
- Java用Cookie简单限制点赞次数
楼主最近在搞一个当下比较流行的点赞功能,这个功能也是让程序员又爱又恨啊 说起爱,点赞是个社会化的动作,全民都在为美好的事情,行为,动作,点赞. 说起恨,你很难在用户没有登录的情况下限制恶意点赞的机器人 ...