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
Space
Power
Reality
Mind
Soul
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.


题意:emmmm六颗宝石....复仇者联盟三.....

  • 力量宝石颜色,
  • 时间宝石绿颜色,
  • 空间宝石蓝色颜色,
  • 灵魂宝石香橙颜色,
  • 现实宝石颜色,
  • 心灵宝石颜色。

输入n个颜色,然后让你输出还有几个宝石没有出现,输出他们的名字。

题解:暴力  昨晚刚开始做,发现很简单,不过写到写到,写了一堆bug出来,花了很长时间...发现自己越来越菜了,a都不会了..

用map<string,int>加标记数组才过的。还是python大法好啊。

#include<bits/stdc++.h>
using namespace std;
map<string,int>m;
int vis[10];
int main()
{
    int n;string s;
    cin>>n;
    m["purple"]=1,m["green"]=2,m["blue"]=3,m["orange"]=4,m["red"]=5,m["yellow"]=6;
    for(int i=0; i<n; i++)
        cin>>s,vis[m[s]]=1;
    cout<<6-n<<endl;
    if(!vis[1])cout<<"Power"<<endl;
    if(!vis[2])cout<<"Time"<<endl;
    if(!vis[3])cout<<"Space"<<endl;
    if(!vis[4])cout<<"Soul"<<endl;
    if(!vis[5])cout<<"Reality"<<endl;
    if(!vis[6])cout<<"Mind"<<endl;
    return 0;
}

n=int(input())
a={"purple":"Power","green":"Time","blue":"Space","orange":"Soul","red":"Reality","yellow":"Mind"}
for i in range(n):
        s=input()
        del(a[s])
print(len(a))
for i in a:
        print(a[i])


猜你喜欢

转载自blog.csdn.net/memory_qianxiao/article/details/80504549