zoukankan      html  css  js  c++  java
  • Testing Round #16 (Unrated)

    比赛链接:https://codeforces.com/contest/1351

    A - A+B (Trial Problem)

    #include <bits/stdc++.h>
    using namespace std;
    
    void solve() {
        int a, b; cin >> a >> b;
        cout << a + b << "
    ";
    }
    
    int main() {
        int t; cin >> t;
        while (t--) solve();
    }

    B - Square?

    #include <bits/stdc++.h>
    using namespace std;
    
    void solve() {
        int a1, b1, a2, b2; cin >> a1 >> b1 >> a2 >> b2;
        if (a1 > b1) swap(a1, b1);
        if (a2 > b2) swap(a2, b2);
        if (a1 + a2 == b1 and b1 == b2) cout << "YES" << "
    ";
        else cout << "NO" << "
    ";
    }
    
    int main() {
        int t; cin >> t;
        while (t--) solve();
    }

    C - Skier

    #include <bits/stdc++.h>
    using namespace std;
    
    void solve() {
        string s; cin >> s;
        map<pair<pair<int, int>, pair<int, int>>, bool> mp;
        pair<int, int> pr{0, 0};
        int ans = 0;
        for (char c : s) {
            pair<int, int> pr0 = pr;
            if (c == 'N') pr.second++;
            else if (c == 'S') pr.second--;
            else if (c == 'W') pr.first--;
            else pr.first++;
            pair<pair<int, int>, pair<int, int>> p1 = make_pair(pr0, pr);
            pair<pair<int, int>, pair<int, int>> p2 = make_pair(pr, pr0);
            if (mp[p1] or mp[p2]) ++ans;
            else mp[p1] = mp[p2] = true, ans += 5;
        }
        cout << ans << "
    ";
    }
    
    int main() {
        int t; cin >> t;
        while (t--) solve();
    }

    我这也算是在线 ak 过一场 cf 了吧 =。=

  • 相关阅读:
    java-学习8
    java-学习7
    java-学习6
    html----h1-6标签
    jquery.cookie介绍和用法
    java-学习5
    java-学习4
    Eclipse里的代码光标变成一个黑色块
    java-学习3(jdk-环境配置)
    箭头函数无法使用this的解决方法
  • 原文地址:https://www.cnblogs.com/Kanoon/p/12846922.html
Copyright © 2011-2022 走看看