• 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 }
  • 相关阅读:
    如何将latex格式转换成word? Lei
    SEWM2012会议报告总结 Lei
    matlab图片到word的过程 Lei
    日记——有点郁闷的一天
    牛博国际开放了,等了一个月才能看牛博。
    做什么事都没有兴趣呢,怎么这么低调呢?
    读UML书
    firefox弹出窗口关闭时执行代码刷新父窗口
    终于关注了一下传说中的小强,firebug
    MOSS Export Site Column/Site Content Type
  • 原文地址:https://www.cnblogs.com/wujianwei/p/2598618.html
Copyright © 2020-2023  润新知