zoukankan      html  css  js  c++  java
  • 牛客小白月赛1 J おみやげをまらいました 【MAP】

    题目链接

    https://www.nowcoder.com/acm/contest/85/J

    思路
    用 MAP 标记 哪一个 打败哪一个 输出的时候 输出对应的 就可以了

    AC代码

    #include <cstdio>
    #include <cstring>
    #include <ctype.h>
    #include <cstdlib>
    #include <cmath>
    #include <climits>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <deque>
    #include <vector>
    #include <queue>
    #include <string>
    #include <map>
    #include <stack>
    #include <set>
    #include <numeric>
    #include <sstream>
    #include <iomanip>
    #include <limits>
    
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    typedef pair <int, int> pii;
    typedef pair <ll, ll> pll;
    
    const double PI  = 3.14159265358979323846264338327;
    const double E   = 2.718281828459;
    const double eps = 1e-6;
    
    const int INF    = 0x3f3f3f3f;
    const int maxn   = 1e5 + 5;
    const int MOD    = 1e9 + 7;
    
    int main()
    {
        map <string, string> m;
        map <string, int> vis;
        string s1, s2;
        for (int i = 0; i < 3; i++)
        {
            cin >> s1 >> s2;
            m[s2]   = s1;
            vis[s1] = 1;
            vis[s2] = 1;
        }
        int n;
        scanf("%d", &n);
        while (n--)
        {
            cin >> s1;
            if (vis[s1])
                cout << m[s1] << endl;
            else
                cout << "Fake
    ";
        }
    }
  • 相关阅读:
    [POJ 1050]To the Max
    P1678 烦恼的高考志愿
    P1873 砍树
    P1102 A-B 数对
    P6771 [USACO05MAR]Space Elevator 太空电梯
    P2347 砝码称重
    P1832 A+B Problem(再升级)
    P1679 神奇的四次方数
    P1877 [HAOI2012]音量调节
    P1049 装箱问题
  • 原文地址:https://www.cnblogs.com/Dup4/p/9433249.html
Copyright © 2011-2022 走看看