AtCoder Beginner Contest 155

比赛链接:https://atcoder.jp/contests/abc155/tasks

A - Poor

题意

判断三个数中是否有两者相等且不等于第三者。

代码

#include <bits/stdc++.h>
using namespace std;
int main() {
    map<int, int> mp;
    for (int i = 0; i < 3; i++) {
        int x; cin >> x;
        ++mp[x];
    }
    cout << (mp.size() == 2 ? "Yes" : "No");
}

B - Papers, Please

题意

判断 $n$ 个数中的偶数是否均为 $3$ 或 $5$ 的倍数。

代码

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    bool ok = true;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        if (x % 2 == 0 and x % 3 and x % 5)
            ok = false;
    }
    cout << (ok ? "APPROVED" : "DENIED");
}

C - Poll

题意

给出 $n$ 个字符串,按照字典序输出出现次数最多的字符串。

代码

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    map<string, int> mp;
    int mx = 0;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        mx = max(mx, ++mp[s]);
    }
    set<string> st;
    for (auto i : mp) 
        if (i.second == mx) 
            st.insert(i.first);
    for (auto i : st) cout << i << "\n";
}

D - Pairs

题意

给出 $n$ 个数,将它们两两相乘后得到的 $\frac{n(n-1)}{2}$ 个积排序,输出第 $k$ 个积。

题解

似乎是区间二分,待填。

E - Payment

题意

有 $10^{100} + 1$ 种纸币,面值分别为 $1,10,10^2,...,10^{(10^{100})}$,计算支付 $n$ 元加上找零最少需要用多少张纸币。

题解

待填。

posted @ 2020-05-24 21:21  Kanoon  阅读(173)  评论(0)    收藏  举报