【水题】Codeforces Round #485 (Div. 2) A. Infinity Gauntlet
题目链接:http://codeforces.com/contest/987/problem/A
题目大意:
输入正整数n与n种看到的颜色,根据颜色来判断宝石,输出未看到的宝石的数量与名称
1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 #define ll long long 6 7 8 map<string,int> m; 9 string ss[] = {"purple","green","blue","orange","red","yellow"}; 10 int book[] = {0,0,0,0,0,0,0}; 11 string sss[] = {"Power","Time","Space","Soul","Reality","Mind"}; 12 int main() 13 { 14 int n; 15 scanf("%d",&n); 16 int p = 6-n; 17 string s; 18 for(int i = 1;i <= n;++i) 19 { 20 cin >> s; 21 m[s] = 1; 22 } 23 cout << p << endl; 24 for(int i = 0;i < 6;++i) 25 { 26 if(m[ss[i]] == 0) 27 { 28 book[i] = 1; 29 } 30 } 31 for(int i = 0;i < 6;++i) 32 { 33 if(book[i]) 34 cout << sss[i] << endl; 35 } 36 return 0; 37 }
文章搬运自我的个人博客http://duny31030.top
原博客为静态博客,因备份丢失无法继续更新,所以又搬运回博客园,可能部分文章阅读体验不好,可以到我的静态博客搜索相同标题查看