Codeforces 987A. Infinity Gauntlet(手速题,map存一下输出即可)

解法:

  1.先将对应的字符串存入map。

  2.然后将输入的串的second置为空。

  3.输出6-n,输出map中的非空串。

 

代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

map <string,string> m; 
int main(){
    m["purple"] = "Power";
    m["green"] = "Time";
    m["blue"] = "Space";
    m["orange"] = "Soul";
    m["red"] = "Reality";
    m["yellow"] = "Mind";
    int n;
    cin >> n;
    int t = n;
    while(n--){
        string s;
        cin >> s;
        m[s] = "";
    }
    cout << 6-t << endl;
    for(auto t:m){
        if(t.second != ""){
            cout << t.second << endl;
        }
    }
    return 0;
}

 

posted @ 2018-05-30 11:04  ninding  阅读(189)  评论(0编辑  收藏  举报