描述

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. The Services(服务)

    datastore和运行时环境的关系就是和一个服务的关系:应用使用API访问一个独立的系统(separate system),这个系统管理应用的所有的独立于应用实例的扩展需求(scaling need ...

  2. 对unsigned int和int进行移位操作的区别

    1. 无符号整数 unsigned int 对unsigned int进行移位操作时,最高位不会有任何特殊性. 无符号整数必须使用%u来打印 #include <stdio.h> int ...

  3. sublime text 2使用经验

    1. Package Control 安装代码: import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.instal ...

  4. Node.js 数据库实时监控库 node-dbmon

    node-dbmon 是一个 Node.js 数据库实时监控库,如果你希望在数据库表数据更改后,或者是文件修改后能更新 GUI,那么这个库正好适合你. https://github.com/strap ...

  5. 软件工程个人项目--Word frequency program

    (一)工程设计时间预计 1.代码编写:2小时 (1)文件夹的遍历以及筛选: (2)文件夹的读取,以及对读取字符的操作: (3)所得结果排序,以及文件输出. 2.程序调试:1小时 (1)编写数据. (2 ...

  6. Hibernate之HQL查询

    一.Hibernate 提供了以下几种检索对象的方式: 导航对象图检索方式: 根据已经加载的对象导航到其他对象 OID 检索方式: 按照对象的 OID 来检索对象 HQL 检索方式:使用面向对象的 H ...

  7. jquery.loadmask.js

    Quick Start 下载之后的目录结构如下图所示: 使用此插件非常简单,如下步骤所示: 1.  引用jquery,1.2.3以上版本 <script type="text/java ...

  8. 在Android4.0中Contacts拨号盘界面剖析(源码)

      通过在 ViewPager 的适配器对象中,发现过一下三行代码 private DialpadFragment mDialpadFragment; private CallLogFragment ...

  9. String 和 byte[]

    使用默认字符集合 Encodes this String into a sequence of bytes using the platform's default charset, storing ...

  10. MFC实现数独(2)

    主要功能描述: 运行程序后对话框会显示一个9x9的待输入数独区域,并提供随机生成数独和生成数独按钮,生成数独按钮后会创建数独并随机显示其中一个至数独区域,随机生成数独会从已生成的数独中随机获取一个并显 ...