NYOJ 25 A Famous Music Composer

A Famous Music Composer

时间限制:1000 ms  |  内存限制:65535 KB

难度:1

描述

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: "冒号后面还有个空格。
 1 #include <stdio.h>
 2 #include <string.h>
 3 int main()
 4 {
 5     char s1[10],s2[10];
 6     int sign = 1;
 7     while(scanf("%s%s",s1,s2) != EOF)
 8     {
 9         printf("Case %d: ",sign++);
10         if(!strcmp(s1,"A#")) printf("%s %s\n","Bb",s2);
11         else if(!strcmp(s1,"Bb")) printf("%s %s\n","A#",s2);
12         else if(!strcmp(s1,"C#")) printf("%s %s\n","Db",s2);
13         else if(!strcmp(s1,"Db")) printf("%s %s\n","C#",s2);
14         else if(!strcmp(s1,"D#")) printf("%s %s\n","Eb",s2);
15         else if(!strcmp(s1,"Eb")) printf("%s %s\n","D#",s2);
16         else if(!strcmp(s1,"F#")) printf("%s %s\n","Gb",s2);
17         else if(!strcmp(s1,"Gb")) printf("%s %s\n","F#",s2);
18         else if(!strcmp(s1,"G#")) printf("%s %s\n","Ab",s2);
19         else if(!strcmp(s1,"Ab")) printf("%s %s\n","G#",s2);
20         else printf("UNIQUE\n");
21     }
22 }
时间: 2024-07-31 04:51:58

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 ar

A Famous Music Composer(南阳oj25)(一道无聊的英文题)

A Famous Music Composer 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描述 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

07-语言入门-07-A Famous Music Composer

题目地址: http://blog.csdn.net/sevenmit/article/details/8231994 描述 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

NYOJ 484 The Famous Clock

#include<stdio.h>#include<string.h>int main(){ int i,n=0; char a[10]; char str[15][5]={"I","II","III","IV","V","VI","VII","VIII","IX","X","

【南阳OJ分类之语言入门】80题题目+AC代码汇总

声明: 题目部分皆为南阳OJ题目. 代码部分包含AC代码(可能不止一个)和最优代码,大部分都是本人写的,并且大部分为c代码和少部分c++代码and极少java代码,但基本都是c语言知识点,没有太多差别,可能代码有的写的比较丑,毕竟知识有限. 语言入门部分题基本都较为简单,是学习编程入门的很好练习,也是ACM的第一步,入门的最佳方法,望认真对待. 本文由csdn-jtahstu原创,转载请注明出处,欢迎志同道合的朋友一起交流学习.本人QQ:1373758426和csdn博客地址. now begi

NYOJ 49 开心的小明

开心的小明 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描述 小明今天很开心,家里购置的新房就要领钥匙了,新房里有一间他自己专用的很宽敞的房间.更让他高兴的是,妈妈昨天对他说:"你的房间需要购买哪些物品,怎么布置,你说了算,只要不超过N 元钱就行".今天一早小明就开始做预算,但是他想买的东西太多了,肯定会超过妈妈限定的N 元.于是,他把每件物品规定了一个重要度,分为5 等:用整数1~5 表示,第5 等最重要.他还从因特网上查到了每件物品的价格(都是整数元).

NYOJ 832 合并游戏

合并游戏 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描述 大家都知道Yougth除了热爱编程之外,他还有一个爱好就是喜欢玩.某天在河边玩耍的时候,他发现了一种神奇的石子,当把两个石子放在一起的时候,后一个石子会消失,而且会蹦出一定数量的金币,这可乐坏了Yougth,但是他想得到最多的金币,他该怎么做? 输入 首先一行,一个n(1<=n<=10),表示有n个石子.接下来n*n的一个矩阵,Aij表示第i个和第j个合并蹦出的金币值(小于10000,注意合并后j会消失).

NYOJ 237 游戏高手的烦恼

游戏高手的烦恼时间限制:1000 ms | 内存限制:65535 KB难度:5描述有一位传说级游戏高手,在闲暇时间里玩起了一个小游戏,游戏中,一个n*n的方块形区域里有许多敌人,玩家可以使用炸弹炸掉某一行或者某一列的所有敌人.他是种玩什么游戏都想玩得 优秀的人,所以,他决定,使用尽可能少的炸弹炸掉所有的敌人. 现在给你一个游戏的状态,请你帮助他判断最少需要多少个炸弹才能炸掉所有的敌人吧. 比如说,下图中X表示敌人 X . X . X . . X . 则,他只需要炸掉第1行与第2列就能炸掉所有的敌

nyoj 10 skiing

skiing 时间限制:3000 ms  |  内存限制:65535 KB 难度:5 描述 Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激.可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你.Michael想知道载一个区域中最长底滑坡.区域由一个二维数组给出.数组的每个数字代表点的高度.下面是一个例子 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 一个人可