[4245]:A Famous Music Composer

这里写图片描述
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

解题思路:这道题好像说了很多东西,刚开始也不知道题目在表达什么,不过细看,其实就是说,如果输入的符号有等价的符号,则输出它的等价符号和对该符号的评价(个人这么理解的,只是为了方便理解),没有等价的,则视为特殊符号(UNIQUE),总的来说,第二个表格没有任何作用
这里本人用的是strcmp()函数

/*
  author : Yangchengfeng
*/

#include<stdio.h>
#include<string.h>
#define N 3
#define M 7

int main()
{
    char test[N], str[M];
    int i = 0;
    while(scanf("%s%s", test, str)!=EOF){
        i++;
        if(!strcmp(test, "A") || !strcmp(test, "B") || !strcmp(test, "C") || !strcmp(test, "D") || !strcmp(test, "E") || !strcmp(test, "F") || !strcmp(test, "G")){
            printf("Case %d: UNIQUE\n", i);
        } else {
            if(!strcmp(test, "A#")){
                printf("Case %d: Bb %s\n", i, str);
            }
            if(!strcmp(test, "Bb")){
                printf("Case %d: A# %s\n", i, str);
            }
            if(!strcmp(test, "C#")){
                printf("Case %d: Db %s\n", i, str);
            }
            if(!strcmp(test, "Db")){
                printf("Case %d: C# %s\n", i, str);
            }
            if(!strcmp(test, "D#")){
                printf("Case %d: Eb %s\n", i, str);
            }
            if(!strcmp(test, "Eb")){
                printf("Case %d: D# %s\n", i, str); 
            }
            if(!strcmp(test, "F#")){
                printf("Case %d: Gb %s\n", i, str);
            }
            if(!strcmp(test, "Gb")){
                printf("Case %d: F# %s\n", i, str); 
            }
            if(!strcmp(test, "G#")){
                printf("Case %d: Ab %s\n", i, str); 
            }
            if(!strcmp(test, "Ab")){
                printf("Case %d: G# %s\n", i, str); 
            }
        }
    }
    return 0;
}

这里写图片描述
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值