ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 알고리즘 히어로즈
    카테고리 없음 2020. 1. 18. 17:35
    반응형

    #include <iostream>
    #include <sstream>
    #include <string>
    #include <algorithm>
    #include <functional>
    #include <vector>
    #include <list>
    #include <queue>
    #include <deque>
    #include <map>
    #include <unordered_map>
    #include <set>
    #include <stack>
    #include <cstring>
    
    using namespace std;
    
    #define MAX_SIZE 100
    #define INF 0x7fffffff
    #define CENDL "\n"
    #define ll long long
    
    int main() {
    
        std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
        int count; cin >> count;
        char chmap[256];
        chmap['b'] = 'd';
        chmap['d'] = 'b';
        chmap['i'] = 'i';
        chmap['m'] = 'm';
        chmap['n'] = 'n';
        chmap['o'] = 'o';
        chmap['p'] = 'q';
        chmap['q'] = 'p';
        chmap['s'] = 'z';
        chmap['z'] = 's';
        chmap['u'] = 'u';
        chmap['v'] = 'v';
        chmap['w'] = 'w';
        chmap['x'] = 'x';
        while (count--) {
            string s; cin >> s;
            const int size = s.size();
    
            bool isNormal = false;
            for (int i = 0; i < size/2; i++) {
                char prev = s[i];
                char next = s[size - 1 - i];
                
                if (chmap[prev] == next) {
                    continue;
                }
                else {
                    isNormal = true;
                    break;
                }
            }
    
            if (isNormal)
                cout << "Normal";
            else
                cout << "Mirror";
    
            cout << CENDL;
        }
        return 0;
    }
    반응형

    댓글

Designed by Tistory.