codeforces 987A. Infinity Gauntlet

题目链接

A. Infinity Gauntlet
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Input

In the first line of input there is one integer nn (0n60≤n≤6) — the number of Gems in Infinity Gauntlet.

In next nn lines there are colors of Gems you saw. Words used for colors are: purplegreenblueorangeredyellow. It is guaranteed that all the colors are distinct. All colors are given in lowercase English letters.

Output

In the first line output one integer mm (0m60≤m≤6) — the number of absent Gems.

Then in mm lines print the names of absent Gems, each on its own line. Words used for names are: PowerTimeSpaceSoulRealityMind. Names can be printed in any order. Keep the first letter uppercase, others lowercase.

Examples
input
Copy
4
red
purple
yellow
orange
output
Copy
2
Space
Time
input
Copy
0
output
Copy
6
Time
Mind
Soul
Power
Reality
Space
Note

In the first sample Thanos already has RealityPowerMind and Soul Gems, so he needs two more: Time and Space.

In the second sample Thanos doesn't have any Gems, so he needs all six.


(妇联梗还行,出题人这么皮的)

题意:给出宝石的颜色,问还缺那些属性,题目有对照表

分析:直接map暴力就行了,注意首字母大写,输出任意(我还以为要字典序)

#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<set>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<cmath>
#include<stack>
#include<iomanip>
#include<functional>
#include <iomanip>
#include<bitset>
using namespace std;
typedef long long LL;
typedef unsigned long long ull;
const int maxn = (int)1e5 + 100;
const int BN = 30;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;
const double eps = 1e-10;
const double PI = acos(-1);
map<string, string>mp;
map<string, int>mps;
string a[] = { "Power","Time","Space","Soul","Reality","Mind" };
string b[] = { "purple","green","blue","orange","red","yellow" };
string s;
vector<string>ans;
bool cmp(string a, string b) {
	return a < b;
}
int main() {
	ans.clear();
	for (int i = 0; i < 6; i++)
		mp[b[i]] = a[i];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		mps[s] = 1;
	}
	for (map<string, string>::iterator it = mp.begin(); it != mp.end(); ++it) {
		if (!mps.count(it->first)) {
			ans.push_back(it->second);
		}
	}
	sort(ans.begin(), ans.end(),cmp);
	int len = ans.size();
	cout << len << endl;
	for (int i = 0; i < len; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/xiuya19/article/details/80527290
今日推荐