zoukankan      html  css  js  c++  java
  • hdoj 4245 水题之A Famous Music Composer

    A Famous Music Composer

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 216    Accepted Submission(s): 129


    Problem Description
    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:


    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:


    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.
     
    Input
    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).
     
    Output
    For each case output the required answer, following the format of the sample.
     
    Sample Input
    Ab minor D# major G minor
     
    Sample Output
    Case 1: G# minor Case 2: Eb major Case 3: UNIQUE
     
    Source
     
     因为题目太简单了 主要是题意丕好理解 果断水掉了 water~~~~
    View Code
     1 #include <iostream>
     2 #include <map>
     3 #include <cstdio>
     4 #include <string>
     5 using namespace std;
     6 
     7 int main()
     8 {
     9     map <string,string>m;
    10     m["A#"]="Bb";
    11     m["Bb"]="A#";
    12                 m["C#"]="Db";    m["Db"]="C#";
    13                 m["D#"]="Eb";    m["Eb"]="D#";
    14                 m["F#"]="Gb";m["Gb"]="F#";
    15                 m["G#"]="Ab";    m["Ab"]="G#";
    16                 string s1,s2;
    17                 int sum=1;
    18                 while(cin>>s1>>s2)
    19                 {
    20                                     cout<<"Case "<<sum++<<": ";
    21                                     if (m.count(s1))
    22                                     {
    23                                       cout<<m[s1]<<" "<<s2<<endl;
    24                                     }
    25                                     else cout<<"UNIQUE"<<endl;
    26                 }
    27                 
    28                 
    29                 return 0;
    30 }
  • 相关阅读:
    Git Bash 下操作文件及文件夹命令
    python django -2 ORM模型
    python django -1
    redis python交互和实际例子
    MongoDB API和python操作
    python mysql 封装
    fabric 自动化部署
    linux 开机自启
    linux shell习题训练
    linux grep sed awk
  • 原文地址:https://www.cnblogs.com/wujianwei/p/2598618.html
Copyright © 2011-2022 走看看