zoukankan      html  css  js  c++  java
  • 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;
    
    }
    
    
  • 相关阅读:
    C语言知识
    Java课程设计——个人
    Java大作业
    DAO模式代码阅读及应用
    有理数设计
    泛型 -Java
    集合框架之ArrayList -Java
    图总结
    树、二叉树、查找算法总结
    编辑器、编译器、文件、IDE等常见概念辨析
  • 原文地址:https://www.cnblogs.com/EDGsheryl/p/9156626.html
Copyright © 2011-2022 走看看