博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
A Famous Music Composer
阅读量:5323 次
发布时间:2019-06-14

本文共 4133 字,大约阅读时间需要 13 分钟。

1 /*A Famous Music Composer  2 时间限制:1000 ms  |  内存限制:65535 KB  3 难度:1  4 描述  5 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   6 (there are musically distinct 12 scale notes, and each may use major or minor tonality). The 12 distinct scale notes are:   7  A        A#=Bb     B           C          C#=Db    D          D#=Eb     E          F           F#=Gb     G          G#=Ab  8   9 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 10  only 12 musically distinct notes. When using one of these as the keynote for a musical key, we can further distinguish between major and 11   minor tonalities. This gives 34 possible keys, of which 24 are musically distinct.  12 In naming his preludes, Mr. B used all the keys except the following 10, which were named instead by their alternate names:  13  Ab minor     A# major    A# minor     C# major     Db minor 14  D# major     D# minor    Gb major     Gb minor     G# major  15 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.  16 输入 17 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, 18  and "tonality" is either "major" or "minor" (quotes for clarify). 19 输出 20 For each case output the required answer, following the format of the sample. 21 样例输入 22 Ab minor 23 D# major 24 G minor 25 样例输出 26 Case 1: G# minor 27 Case 2: Eb major 28 Case 3: UNIQUE 29 来源 30 hdu 31 上传者 32 李如兵 33 */  34 #include
35 #include
36 int main() 37 { 38 char s[10], c[10],s1[]="A",s2[]="B",s3[]="C",s4[]="D",s5[]="E",s6[]="F",s7[]="G",c1[]="A#",c2[]="Bb",c3[]="C#",c4[]="Db",c5[]="D#",c6[]="Eb",c7[]="F#",c8[]="Gb",c9[]="G#",c10[]="Ab"; 39 int i=1; 40 memset(s,'\0',10); 41 memset(c,'\0',10); 42 while(scanf("%s%s",s,c) != EOF ) 43 { 44 getchar(); 45 if( strcmp(s,s1) == 0 || strcmp(s,s2) == 0 || strcmp(s,s3) == 0 || strcmp(s,s4) == 0 || strcmp(s,s5) == 0 || strcmp(s,s6) == 0 || strcmp(s,s7) == 0) 46 { 47 printf("Case %d: UNIQUE\n",i++); 48 continue; 49 } 50 else if( strcmp(s,c1) == 0 ) 51 { 52 strcpy(s,c2); 53 printf("Case %d: %s %s\n",i++,s,c); 54 continue; 55 } 56 else if( strcmp(s,c2) == 0 ) 57 { 58 strcpy(s,c1); 59 printf("Case %d: %s %s\n",i++,s,c); 60 continue; 61 } 62 else if( strcmp(s,c3) == 0 ) 63 { 64 strcpy(s,c4); 65 printf("Case %d: %s %s\n",i++,s,c); 66 continue; 67 } 68 else if( strcmp(s,c4) == 0 ) 69 { 70 strcpy(s,c3); 71 printf("Case %d: %s %s\n",i++,s,c); 72 continue; 73 } 74 else if( strcmp(s,c5) == 0 ) 75 { 76 strcpy(s,c6); 77 printf("Case %d: %s %s\n",i++,s,c); 78 continue; 79 } 80 else if( strcmp(s,c6) == 0 ) 81 { 82 strcpy(s,c5); 83 printf("Case %d: %s %s\n",i++,s,c); 84 continue; 85 } 86 else if( strcmp(s,c7) == 0 ) 87 { 88 strcpy(s,c8); 89 printf("Case %d: %s %s\n",i++,s,c); 90 continue; 91 } 92 else if( strcmp(s,c8) == 0 ) 93 { 94 strcpy(s,c7); 95 printf("Case %d: %s %s\n",i++,s,c); 96 continue; 97 } 98 else if( strcmp(s,c9) == 0 ) 99 {100 strcpy(s,c10);101 printf("Case %d: %s %s\n",i++,s,c);102 continue;103 }104 else if( strcmp(s,c10) == 0 )105 {106 strcpy(s,c9);107 printf("Case %d: %s %s\n",i++,s,c);108 continue;109 }110 }111 return 0;112 }

 

转载于:https://www.cnblogs.com/a604378578/p/3661382.html

你可能感兴趣的文章
12 生成器和生成器表达式
查看>>
bzoj2424: [HAOI2010]订货
查看>>
go语言reflect实验
查看>>
再谈AutoResetEvent和ManualResetEvent 之详细解说
查看>>
sql server日期与时间函数
查看>>
leetcode Minimum Depth of Binary Tree python
查看>>
IOS开发--动画篇-->计时定时器
查看>>
二月主题读书整理——元技能系列
查看>>
Howto: (Almost) Everything In Active Directory via C#
查看>>
HttpClient-get请求/Post请求/Post-Json/Header
查看>>
小G的城堡
查看>>
C#回顾 – 4.IEnumerable 集合
查看>>
1050. String Subtraction
查看>>
软件工程结对编程第一次作业
查看>>
listbox横向排列
查看>>
NodeOS操作系统
查看>>
大神教你如何解决Linux系统80端口被占用
查看>>
VIM GDB操作
查看>>
七、context command
查看>>
Android中ListView的用法及优化
查看>>