描述

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. MFC使用ShowWindow(SW_MAXIMIZE)任务栏消失的处理

    ShowWindow(SW_SHOWMAXIMIZED);//窗口最大化 问题:在写程序时,如果包含了标题栏,但是没有包含最大化按钮或者最小话按钮. 那么人工用ShowWindow(SW_MAXIMI ...

  2. [Hive - LanguageManual] VirtualColumns

    Virtual Columns Simple Examples Virtual Columns Hive 0.8.0 provides support for two virtual columns: ...

  3. 使用DBCC SHOW_STATISTICS展示索引的统计信息

    在开始之前搭建演示环境: USE master GO SET NOCOUNT ON --创建表结构 IF OBJECT_ID(N'ClassA', N'U') IS NOT NULL DROP TAB ...

  4. 转:高性能Mysql主从架构的复制原理及配置详解

    温习<高性能MySQL>的复制篇. 1 复制概述 Mysql内建的复制功能是构建大型,高性能应用程序的基础.将Mysql的数据分布到多个系统上去,这种分布的机制,是通过将Mysql的某一台 ...

  5. 教你区分LVDS屏线及屏接口定义

    现在碰到液晶屏大多是LVDS屏线,经常碰到什么单6,双6 单8双8.如何区分呢?我以前也不知道,后在网上收集学习后才弄明白方法1数带 “ -”的这种信号线一共有几对,有10对的减2对就是双8,有8对的 ...

  6. JDBC学习笔记(4)——PreparedStatement的使用

    PreparedStatement public interface PreparedStatement extends Statement;可以看到PreparedStatement是Stateme ...

  7. BestCoder Round #66 (div.2) hdu5592

    GTW likes math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  8. Linux优化之IO子系统监控与调优

    Linux优化之IO子系统 作为服务器主机来讲,最大的两个IO类型 : 1.磁盘IO 2.网络IO 这是我们调整最多的两个部分所在 磁盘IO是如何实现的 在内存调优中,一直在讲到为了加速性能,linu ...

  9. zookeeper的配置项

    1 tickTime:CS通信心跳数 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳.tickTime以毫秒为单位. tick ...

  10. linux信号量超过系统限制

    部署一台新服务器,信号量报错,观察也没有key冲突,错误分析及解决如下: 创建一个不存在的信号量集返回参数错误的报错,因为信号量集的信号量数量超过了系统限制. 系统默认 /home/poc#ipcs ...