您的位置:首页 > 其它

NYOJ25 A Famous Music Composer

2014-04-07 11:40 417 查看
原题链接

史上最水题。

#include <stdio.h>
#include <string.h>

struct Node{
char *a, *b;
} sam[5] = {{"A#", "Bb"}, {"C#", "Db"}, {"D#", "Eb"}, {"F#", "Gb"}, {"G#", "Ab"}};

int main(){
char note[3], tona[6];
int count = 1, ok;
while(scanf("%s%s", note, tona) == 2){
printf("Case %d: ", count++);
if(strlen(note) == 1){
printf("UNIQUE\n");
continue;
}

for(int i = 0; i < 5; ++i){
if(strcmp(note, sam[i].a) == 0) memcpy(note, sam[i].b, 2);
else if(strcmp(note, sam[i].b) == 0) memcpy(note, sam[i].a, 2);
}
printf("%s %s\n", note, tona);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  NYOJ25 A Famous Musi