题目
原题链接:A. Infinity Gauntlet
题意
六颗宝石对应六种颜色,给出出现的颜色,请列出没出现的宝石的名称。
代码
#include<bits/stdc++.h>
using namespace std;
int main() {
map<string,string> m;
map<string,string>::iterator it;
m["purple"]="Power";
m["green"]="Time";
m["blue"]="Space";
m["orange"]="Soul";
m["red"]="Reality";
m["yellow"]="Mind";
int n;
string s;
cin>>n;
for(int i=0;i<n;i++){
cin>>s;
m[s]="";
}
printf("%d\n",6-n);
for(it=m.begin();it!=m.end();it++){
if(it->second != ""){
cout<<it->second<<endl;
}
}
return 0;
}
网友评论