hdu4245

水题,不说什么了。

/*

 * hdu1001/win.cpp

 * Created on: 2012-7-24

 * Author    : ben

 */

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>

#include <ctime>

#include <iostream>

#include <algorithm>

#include <queue>

#include <set>

#include <map>

#include <stack>

#include <string>

#include <vector>

#include <deque>

#include <list>

#include <functional>

#include <numeric>

#include <cctype>

using namespace std;

char tonality[30], note[30];

const string names[17] = {"A", "A#", "Bb", "B", "C", "C#", "Db", "D", "D#", "Eb", "E", "F", "F#", "Gb", "G", "G#", "Ab"};

const int switchto[17] = { -1, 2, 1, -1, -1, 6, 5, -1, 9, 8, -1, -1, 13, 12, -1, 16, 15 };

int getswitch(char * str) {

    string temp(str);

    for(int i = 0; i < 17; i++) {

        if(temp == names[i]) {

            return switchto[i];

        }

    }

    return -1;

}

//

//bool judge(int index, bool flag) {

//    return true;

//}



int main() {

#ifndef ONLINE_JUDGE

    freopen("data.in", "r", stdin);

#endif

    int T = 0;

    while(scanf("%s %s", note, tonality) == 2) {

        printf("Case %d: ", ++T);

        int ret = getswitch(note);

        if(ret == -1) {

            puts("UNIQUE");

            continue;

        }

        printf("%s %s\n", names[ret].c_str(), tonality);

    }

    return 0;

}

你可能感兴趣的:(HDU)