2022 RoboCom 世界机器人开发者大赛-高职组(省赛)

发布时间 2023-07-14 13:24:25作者: PHarr

RC-v1 您好呀

print("Nin Hao Ya ~")

RC-v2 爷爷奶奶您好呀

#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    string a , b , c ;
    cin >> a >> b >> c;
    cout << b << " ";
    if( a == "M" ) cout << "YeYe Nin Hao Ya ~";
    else cout << "NaiNai Nin Hao Ya ~";
    return 0;
}

RC-v3 智能监测

时间是假的

#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n , T , p;
    string time;
    cin >> n >> T;
    for( ; n ; n -- ){
        cin >> time >> p;
        if( 80 - T <= p && p <= 80 + T )
            continue;
        cout << time << " " << p << "\n";
    }
    return 0;
}

RC-v4 生成字母串

认真读读题

#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    char a;
    string s;
    cin >> n >> a >> s;

    cout << a;
    for (auto i: s) {
        if (i == '0') {
            if (a >= 'a' && a <= 'z')
                a = a + 'A' - 'a';
            else a = a + 'a' - 'A';
        } else {
            if (a >= 'a' && a <= 'z') {
                if (a != 'a') a--;
                else continue;
            } else {
                if (a != 'Z')a++;
                else continue;
            }
        }
        cout << a;
    }
    return 0;
}

RC-v5 数字宝宝

#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int a, b, x = 0, y = 1;
    cin >> a >> b;
    while (a) x += a % 10, a /= 10;
    while (b) y *= b % 10, b /= 10;
    if( x < y ) swap( x , y );
    cout << x << y;
    return 0;
}

RC-v6 拼瓷砖

每次去额外检查一行或一列即可

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define mp make_pair

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<string> g(n);
    map<pair<char, int>, int> cnt;
    for (auto &i: g)
        cin >> i;
    for (int i = 0, t, f, s; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (g[i][j] == '*') continue;
            t = 0, f = 1, s = g[i][j];
            while (f) {
                if (i + t >= n || j + t >= m || s != g[i + t][j + t]) f = 0;
                for (int k = i, v = j + t; f && k <= i + t; k++)
                    if (g[k][v] != s) f = 0;
                for (int k = j, v = i + t; f && k <= j + t; k++)
                    if (g[v][k] != s) f = 0;
                for (int k = i, v = j + t; f && k <= i + t; k++)
                    g[k][v] = '*';
                for (int k = j, v = i + t; f && k <= j + t; k++)
                    g[v][k] = '*';
                t += f;
            }
            cnt[mp(s, t)]++;
        }
    }
    cout << cnt.size() << "\n";
    for (auto [k, v]: cnt)
        cout << "color = " << k.first << "; size = " << k.second << "; amount = " << v << "\n";

    return 0;
}

RC-v7 燕归来

用两个set就行

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define mp make_pair

int32_t main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    int n;
    string x;
    set<string> a, b;
    for (cin >> n; n; n--)
        cin >> x, a.insert(x);
    for (cin >> n; n; n--) {
        cin >> x;
        if (a.count(x)) a.erase(x);
        else b.insert(x);
    }
    if (a.empty()) cout << "All Back\n";
    else {
        cout << "Missing: " << a.size() << "\n";
        for (auto i: a)
            cout << i << "\n";
    }
    if (b.empty()) cout << "All Known\n";
    else {
        cout << "New: " << b.size() << "\n";
        for (auto i: b)
            cout << i << "\n";
    }
    return 0;
}