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

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

题目连接:

http://codeforces.com/contest/987/problem/A

Description

You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:

  • the Power Gem of purple color,
  • the Time Gem of green color,
  • the Space Gem of blue color,
  • the Soul Gem of orange color,
  • the Reality Gem of red color,
  • the Mind Gem of yellow color.

Using colors of Gems you saw in the Gauntlet determine the names of absent Gems.

Sample Input

4
red
purple
yellow
orange

Sample Output

2
Space
Time

题意

无限手套有六颗宝石,现在已经有了几种颜色的,问现在缺少哪些能力

题解:

用map暴力处理

代码

#include <bits/stdc++.h>

using namespace std;

map<string, string> m;
int n;
string d; int main() {
m.insert(make_pair("red", "Reality"));
m.insert(make_pair("purple", "Power"));
m.insert(make_pair("green", "Time"));
m.insert(make_pair("blue", "Space"));
m.insert(make_pair("orange", "Soul"));
m.insert(make_pair("yellow", "Mind"));
cin >> n;
for (int i = 0; i < n; i++) {
cin >> d;
m.erase(d);
}
cout << m.size() << endl;
for (auto i:m)
cout << i.second << endl; }
上一篇:八大排序算法——堆排序(动图演示 思路分析 实例代码java 复杂度分析)


下一篇:HDU OJ 5317 RGCDQ( 2015多校联合训练第3场) 暴力打表+小技巧