描述

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
 import java.util.Scanner;

 public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
String s1;
String s2;
String compare="A B C D E F G";
String output=null;
int time; time=1;
while(scanner.hasNext()){
s1=scanner.next();
s2=scanner.next(); if(compare.indexOf(s1)!=-1)
output="UNIQUE"; else if(s1.compareTo("A#")==0)
output="Bb"+" "+s2; else if(s1.compareTo("Bb")==0)
output="A#"+" "+s2; else if(s1.compareTo("C#")==0)
output="Db"+" "+s2; else if(s1.compareTo("Db")==0)
output="C#"+" "+s2; else if(s1.compareTo("D#")==0)
output="Eb"+" "+s2; else if(s1.compareTo("Eb")==0)
output="D#"+" "+s2; else if(s1.compareTo("F#")==0)
output="Gb"+" "+s2; else if(s1.compareTo("Gb")==0)
output="F#"+" "+s2; else if(s1.compareTo("G#")==0)
output="Ab"+" "+s2; else if(s1.compareTo("Ab")==0)
output="G#"+" "+s2; System.out.println("Case "+time+": "+output);
time++;
} }
}
 

A Famous Music Composer的更多相关文章

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

    题目地址: http://blog.csdn.net/sevenmit/article/details/8231994  描述 Mr. B is a famous music composer. On ...

  2. NYOJ 25 A Famous Music Composer

    A Famous Music Composer 时间限制:1000 ms  |  内存限制:65535 KB 难度:1   描述 Mr. B is a famous music composer. O ...

  3. nyoj25-A Famous Music Composer

    A Famous Music Composer 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描述 Mr. B is a famous music composer. One ...

  4. nyoj 25-A Famous Music Composer(字符串)

    25-A Famous Music Composer 内存限制:64MB 时间限制:1000ms Special Judge: No accepted:4 submit:9 题目描述: Mr. B i ...

  5. 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 ...

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

    小技巧:本文之前由csdn自动生成了一个目录,不必下拉一个一个去找,可通过目录标题直接定位. 本文转载自本人的csdn博客,复制过来的,排版就不弄了,欢迎转载. 声明: 题目部分皆为南阳OJ题目. 代 ...

  7. 南阳oj水题集合,语言的灵活运用

    a+b 输入 输入两个数,a,b 输出 输出a+b的值 样例输入 2 3 样例输出 5 c/c++ #include<iostream> using namespace std; int ...

  8. Laravel Composer and ServiceProvider

    Composer and: 创建自定义类库时,按命名空间把文件夹结构组织好 composer.json>autoload>classmap>psr-4 composer dump-a ...

  9. 基于Composer Player 模型加载和相关属性设置

    主要是基于达索软件Composer Player.的基础上做些二次开发. public class ComposerToolBarSetting { public bool AntiAliasingO ...

随机推荐

  1. MAC机常用快捷键整理表格

    MAC机常用快捷键整理表格 范围 快捷键 说明 图形   (Command 键)在某些 Apple 键盘上,此键也可能为标志()     Control (Control 键)     Alt Opt ...

  2. post和put的区别

    post : 标识的是处理请求中资源表述的资源 put :  标识的是请求的资源表述 post : 支持多种类型的资源 put  : 支持单一的资源

  3. 详细理解 > /dev/null 2>&1

    0:表示键盘输入(stdin) 1:表示标准输出(stdout),系统默认是1 2:表示错误输出(stderr) "command >/dev/null 2>&1 &am ...

  4. HDU 2425 DNA repair (AC自动机+DP)

    DNA repair Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  5. Umbraco中的Member登录时的Lock out功能

    请参看文章 https://our.umbraco.org/forum/using-umbraco-and-getting-started/76389-preventing-member-lock-o ...

  6. jeecms附件标签用法

    [#if content.attachments?size gt 0] [#list content.attachments as attach] <a id="attach${att ...

  7. Cloud Computing Deployment Models

    Cloud computing can broadly be broken down into three main categories based on the deployment model. ...

  8. JTextField限制 输入数字

    貌似有很多方法,先记了再说... 1.限制输入数字 用法 textfield.setDocument(new IntegerDocument()); class IntegerDocument ext ...

  9. VM中ubuntu已经正确配置了静态IP仍无法上网

    情况描述:正确配置了ubuntu的IP,getway,DNS..无法ping通getway. 环境:宿主机:win7 32Bit  虚拟机:ununtu 10.04  VM:9.0.1 build-8 ...

  10. 放开Linux内核对用户进程可打开文件数和TCP连接的限制

    一. 检查linux内核uname -alsb_release -a 二. 用户进程可打开文件数限制1) vim /etc/security/limits.conf*       -      nof ...