CF-Codeforces Round #485 (Div. 2)-A-Infinity Gauntlet

ACM模版

描述

CF-Codeforces Round #485 (Div. 2)-A-Infinity Gauntlet_第1张图片

题解

两个 map m a p 或者一个 map m a p 就能解决。

代码

#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

int n;
map<string, string> mss;
map<string, int> msi;

static void init()
{
    mss["purple"] = "Power";
    mss["green"] = "Time";
    mss["blue"] = "Space";
    mss["orange"] = "Soul";
    mss["red"] = "Reality";
    mss["yellow"] = "Mind";
}

int main(int argc, const char * argv[])
{
#if DEBUG
    freopen("/Users/zyj/Desktop/input.txt", "r", stdin);
    freopen("/Users/zyj/Desktop/output.txt", "w", stdout);
#endif

    init();

    cin >> n;

    string s;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        msi[s] = 1;
    }

    cout << 6 - n << '\n';
    for (auto it : mss)
    {
        if (!msi[it.first])
        {
            cout << it.second << '\n';
        }
    }

    return 0;
}

你可能感兴趣的:(STL)