AtCoder Beginner Contest 323

这篇具有很好参考价值的文章主要介绍了AtCoder Beginner Contest 323。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

有的人边上课边打abc

A - Weak Beats (abc323 A)

题目大意

给定一个\(01\)字符串,问偶数位(从\(1\)开始) 是否全为\(0\)

解题思路

遍历判断即可。

神奇的代码
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    bool ok = true;
    for (int i = 1; i < s.size(); i += 2) {
        ok &= (s[i] == '0');
    }
    if (ok)
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';

    return 0;
}



B - Round-Robin Tournament (abc323 B)

题目大意

给定\(n\)个人与其他所有人的胜负情况。问最后谁赢。

一个人获胜次数最多则赢,若次数相同,则编号小的赢。

解题思路

统计每个人的获胜次数,排个序即可。

神奇的代码
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto& i : a) {
        string s;
        cin >> s;
        i = count(s.begin(), s.end(), 'o');
    }
    vector<int> id(n);
    iota(id.begin(), id.end(), 0);
    sort(id.begin(), id.end(), [&](int x, int y) {
        if (a[x] != a[y])
            return a[x] > a[y];
        else
            return x < y;
    });
    for (auto& i : id)
        cout << i + 1 << ' ';

    return 0;
}



C - World Tour Finals (abc323 C)

题目大意

给定每道题的分数,以及每个人的通过情况,每个人的得分为解决题目的分的和,其中第\(i\)个人还有\(i\)的额外加分。

对于每个人,问最少还得解决多少道题,才能成为第一。

解题思路

因为范围只有\(100\),可以采取最朴素的做法,先统计每个人的分数,得到当前最高的分数。

然后对于每个人,从未通过题目的分数,排个序,大到小依次解决获得分数,看何时超过最高分。

由于每个人有不同的额外得分,所以不会有同分。

时间复杂度为 \(O(n^2\log n)\)

也可以每次遍历未通过的题目,找分数最大的,这样复杂度为\(O(n^3)\)同样可以通过。

神奇的代码
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    for (auto& i : a)
        cin >> i;
    vector<int> score(n);
    vector<string> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
        score[i] = i + 1;
        for (int j = 0; j < m; ++j)
            score[i] += a[j] * (s[i][j] == 'o');
    }
    int maxx = *max_element(score.begin(), score.end());
    for (int i = 0; i < n; ++i) {
        if (score[i] == maxx) {
            cout << 0 << '\n';
            continue;
        }
        int dis = maxx - score[i];
        vector<int> unsolve;
        for (int j = 0; j < m; ++j)
            if (s[i][j] == 'x')
                unsolve.push_back(a[j]);
        sort(unsolve.begin(), unsolve.end(), greater<int>());
        int ans = 0;
        for (; dis > 0 && ans < unsolve.size(); ++ans) {
            dis -= unsolve[ans];
        }
        cout << ans << '\n';
    }

    return 0;
}



D - Merge Slimes (abc323 D)

题目大意

\(n\)类数字,第 \(i\)类数字为 \(s_i\),有 \(c_i\)个。

同类数字可以两两合并,得到一个\(s_i + s_i\)数字。

问最后剩下的数字数量。

解题思路

因为数字很大,可以考虑用map存对应数的数量。

但是不能遍历\(map\)的每个元素,然后合并,累计到更大的数里。因为如果更大的数不存在,会插入到 \(map\)中,从而可能导致原因迭代器失效。

但考虑到一类元素不断合并,最终停止时,其个数一定是\(1\),就不用管它了,我们只考虑一开始的那些类别。 因此事先用set储存原来的数的类别。

然后对于set的每一个类别,从小到大考虑不断合并,直到数量变为\(1\)。由于每次合并数量都除以 \(2\)。因此每一类最多 \(\log\)次就结束了。

最后看 map里剩余数的个数。

神奇的代码
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    unordered_map<LL, int> cnt;
    set<int> a;
    for (int i = 0; i < n; ++i) {
        int s, c;
        cin >> s >> c;
        cnt[s] = c;
        a.insert(s);
    }
    int ans = 0;
    for (auto& i : a) {
        int sum = 0;
        for (LL j = i; true; j = j + j) {
            sum = (sum + cnt[j]);
            if (sum < 2) {
                cnt[j] = sum;
                break;
            }
            cnt[j] = sum % 2;
            sum /= 2;
        }
    }
    for (auto& i : cnt) {
        ans += i.second;
    }
    cout << ans << '\n';

    return 0;
}



E - Playlist (abc323 E)

题目大意

给定\(n\)首歌的播放时间。

从第\(0\)秒,随机选一首歌播放。当一首歌播放完后,立刻随机选下一首歌播放。

问第 \(X + 0.5\)秒 时播放第一首歌的概率。

解题思路

假设第一首歌的播放时长为\(t\)

那么要在 \(X + 0.5\)秒播放第一首歌,则要求第一首歌在第 \(X, X - 1, X - 2, ..., X - t + 1\)秒中的一秒开始播放。

而如果我知道能够在\(X,X-1,X-2,...,X-t + 1\)秒开始播放的概率(或者说这些时刻恰好播放完的概率),那么这些概率的和,再乘以\(\frac{1}{n}\)(即选到第一首歌播放的概率),就是答案。

\(dp[i]\)表示能够在第 \(i\)秒开始播放的概率,转移则枚举之前播放的是哪一首歌,比如第 \(j\)首,播放时长为\(t_j\),则有 \(dp[i] += dp[i - t_j] \times \frac{1}{n}\)

\(dp[i] = \sum_{t_j \leq i} dp[i - t_j] \times \frac{1}{n}\)

初始条件就是\(dp[0] = 1\)。即第 \(0\)秒肯定能够播放一首歌。

最后答案就是\(\sum_{i = x - t + 1}^{x} dp[i] \times \frac{1}{n}\)

时间复杂度为 \(O(n^2)\)

神奇的代码
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

const int mo = 998244353;

int qpower(int a, int b) {
    int ret = 1;
    while (b) {
        if (b & 1) {
            ret = 1ll * ret * a % mo;
        }
        a = 1ll * a * a % mo;
        b >>= 1;
    }
    return ret;
}

int inv(int x) { return qpower(x, mo - 2); }

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, x;
    cin >> n >> x;
    vector<int> t(n);
    for (auto& i : t) {
        cin >> i;
    }
    vector<int> dp(x + 1);
    int one = inv(n);
    dp[0] = 1;
    for (int i = 1; i <= x; ++i) {
        int sum = 0;
        for (auto& j : t) {
            if (i < j)
                continue;
            sum += 1ll * dp[i - j] * one % mo;
            if (sum >= mo)
                sum -= mo;
        }
        dp[i] = sum;
    }
    int ans = 0;
    for (int i = max(0, x - t[0] + 1); i <= x; ++i) {
        ans = ans + dp[i];
        if (ans >= mo)
            ans -= mo;
    }
    ans = 1ll * ans * one % mo;
    cout << ans << '\n';

    return 0;
}



F - Push and Carry (abc323 F)

题目大意

二维平面,推箱子。给定你的位置,箱子位置,目标位置,一次上下左右移动一格,问把箱子推到目标位置的最小步数。

解题思路

虽然坐标范围挺大的,但实际上决策只有两种。枚举两种决策分别计算下步数取最小即可。

假设箱子在左下,目标位置在右上。很显然,推箱子只有两个决策:

  • 先向上推,再向右推。
  • 先向右推,再向上推。

而为了把箱子向上推,那么事先要走到箱子的下方。同理向右推,要事先走到箱子的左方。

最终步数的贡献来自于:

  • 起始位置走到推箱子的位置的步数
  • 推动箱子的步数(固定的,为箱子位置目标位置的曼哈顿距离)
  • 中间转动方向时额外需要的步数(固定的,为\(2\)),比如向上推时,你在箱子下方,然后要向右推,你需要走到箱子的左方,步数为\(2\)

因此只有第一个位置需要枚举,事实上就两种情况:

  • 先向上推,则求出初始位置到箱子下方的距离
  • 先向右推,则求出初始位置到箱子左方的距离

而这个距离事实上也是个曼哈顿距离,因为除了箱子别无障碍,两种方式到达指定位置中,必有一种是畅通无阻的。

当注意一种情况,当初始位置、箱子位置、到达箱子的位置处于同一条线,且箱子位置在中间的时候,此时并不是畅通无阻的,必须要偏移一下。比如初始位置在左边,箱子在中间,为了把箱子往左推,你要跑到箱子右边,但不能穿过箱子,此时的步数在曼哈顿距离的基础上还要\(+2\),即先向上走或向下走,再走回来。

代码里两种情况的分别考虑就相当于交换了下两个坐标,再考虑一次。

神奇的代码
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int sign(LL x) {
    if (x == 0)
        return 0;
    else if (x > 0)
        return 1;
    else
        return -1;
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    array<array<LL, 2>, 3> pos;
    for (auto& i : pos)
        for (auto& j : i)
            cin >> j;
    auto& [player, box, target] = pos;
    auto dis = [&](const array<LL, 2>& a, const array<LL, 2>& b) {
        return abs(a[0] - b[0]) + abs(a[1] - b[1]);
    };
    LL bound = dis(box, target);
    auto in_middle = [](LL l, LL m, LL r) {
        LL L = min(l, r), R = max(l, r);
        return m > L && m < R;
    };
    auto solve = [&]() {
        LL ret = bound;
        int d = sign(box[0] - target[0]);
        if (d == 0)
            return numeric_limits<LL>::max();
        array<LL, 2> t1 = box;
        t1[0] += d;
        ret += dis(player, t1);
        if ((player[0] == t1[0] && player[0] == box[0] &&
             in_middle(player[1], box[1], t1[1])) ||
            (player[1] == t1[1] && player[1] == box[1] &&
             in_middle(player[0], box[0], t1[0])))
            ret += 2;
        if (box[1] != target[1])
            ret += 2;
        return ret;
    };
    LL ans = solve();
    for (auto& i : pos)
        swap(i[0], i[1]);
    ans = min(ans, solve());
    cout << ans << '\n';

    return 0;
}



G - Inversion of Tree (abc323 G)

题目大意

给定一个关于\(n\)的全排列\(p\)。对于每个\(k = 0,1,2,...,n - 1\),问有多少种形态的树,满足树上恰好有\(k\)条边\((u,v)(u < v)\),有 \(p_u > p_v\)

解题思路

是一道关于矩阵树黑科技的计数问题。

考虑朴素做法,假设给定的排列\(p\)\(k\)个逆序对 \((i, j), p_i > p_j\)

先花 \(O(2^k)\)枚举要保留哪些边,那问题就剩下:

给定一张\(n\)个点的完全图,我要求删除一些边,得到一棵树,其中特定边要保留下来,特定边要去掉,其余边无所谓。问这种树的方案数。

这种图的生成树计数问题,矩阵树科技可以解决。

矩阵树定理指一个关于图的矩阵\(L\)(拉普拉斯矩阵),它的行列式的任意余子式(去掉任一行、任一列)都是一样的,且等于该图的生成树个数。这个图可以有向、无向,可以有重边,但不能有自环。

其中拉普拉斯矩阵\(L\)=度数矩阵\(D-\)邻接矩阵\(A\)

度数矩阵\(D_{ii}=\)与点 \(i\)相连的边的个数,边有边权时则为边权和。其余为 \(0\)

邻接矩阵\(A_{ij}=\)\((i,j)\)的个数,边有边权时则为边权和。

其矩阵的任意余子式的结果即为\(\sum_{T} \prod_{e_i \in T} w_{e_i}\)\(w_i\)为第\(i\)条边的边权,\(T\)是所有生成树的集合,每个元素是一些列边的集合。 当边权为\(1\)时就是生成树的数量。

现在我们要求保留了一些边的生成树的方案数,怎么做呢?

考虑生成函数的思想,我们把要保留的边的边权设为 \(x\)(就生成函数里无意义的自变量),其余边权为 \(1\)。于是其矩阵\(L\)的余子式是一个关于 \(x\)的多项式,最高次的系数就是保留了特定边的方案数。

因此我们把上述 \(k\)个逆序对对应的边的边权全设为 \(x\),其余为 \(1\),其矩阵 \(L\)的余子式就是一个关于\(x\)的多项式,其中\(x^i\)的系数就是恰好保留了 i$个特殊边(逆序对)的方案数。

问题剩下如何快速地求出这个余子式套个板子吧文章来源地址https://www.toymoban.com/news/detail-710672.html

神奇的代码
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

template <unsigned M_> struct ModInt {
    static constexpr unsigned M = M_;
    unsigned x;
    constexpr ModInt() : x(0U) {}
    constexpr ModInt(unsigned x_) : x(x_ % M) {}
    constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
    constexpr ModInt(int x_)
        : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M))
                                              : x_) {}
    constexpr ModInt(long long x_)
        : x(((x_ %= static_cast<long long>(M)) < 0)
                ? (x_ + static_cast<long long>(M))
                : x_) {}
    ModInt& operator+=(const ModInt& a) {
        x = ((x += a.x) >= M) ? (x - M) : x;
        return *this;
    }
    ModInt& operator-=(const ModInt& a) {
        x = ((x -= a.x) >= M) ? (x + M) : x;
        return *this;
    }
    ModInt& operator*=(const ModInt& a) {
        x = (static_cast<unsigned long long>(x) * a.x) % M;
        return *this;
    }
    ModInt& operator/=(const ModInt& a) { return (*this *= a.inv()); }
    ModInt pow(long long e) const {
        if (e < 0)
            return inv().pow(-e);
        ModInt a = *this, b = 1U;
        for (; e; e >>= 1) {
            if (e & 1)
                b *= a;
            a *= a;
        }
        return b;
    }
    ModInt inv() const {
        unsigned a = M, b = x;
        int y = 0, z = 1;
        for (; b;) {
            const unsigned q = a / b;
            const unsigned c = a - q * b;
            a = b;
            b = c;
            const int w = y - static_cast<int>(q) * z;
            y = z;
            z = w;
        }
        assert(a == 1U);
        return ModInt(y);
    }
    ModInt operator+() const { return *this; }
    ModInt operator-() const {
        ModInt a;
        a.x = x ? (M - x) : 0U;
        return a;
    }
    ModInt operator+(const ModInt& a) const { return (ModInt(*this) += a); }
    ModInt operator-(const ModInt& a) const { return (ModInt(*this) -= a); }
    ModInt operator*(const ModInt& a) const { return (ModInt(*this) *= a); }
    ModInt operator/(const ModInt& a) const { return (ModInt(*this) /= a); }
    template <class T> friend ModInt operator+(T a, const ModInt& b) {
        return (ModInt(a) += b);
    }
    template <class T> friend ModInt operator-(T a, const ModInt& b) {
        return (ModInt(a) -= b);
    }
    template <class T> friend ModInt operator*(T a, const ModInt& b) {
        return (ModInt(a) *= b);
    }
    template <class T> friend ModInt operator/(T a, const ModInt& b) {
        return (ModInt(a) /= b);
    }
    explicit operator bool() const { return x; }
    bool operator==(const ModInt& a) const { return (x == a.x); }
    bool operator!=(const ModInt& a) const { return (x != a.x); }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& a) {
        return os << a.x;
    }
};

// det(a + x I)
// O(n^3)
//   Call by value: Modifies a (Watch out when using C-style array!)
template <class T> vector<T> charPoly(vector<vector<T>> a) {
    const int n = a.size();
    // upper Hessenberg
    for (int j = 0; j < n - 2; ++j) {
        for (int i = j + 1; i < n; ++i) {
            if (a[i][j]) {
                swap(a[j + 1], a[i]);
                for (int ii = 0; ii < n; ++ii)
                    swap(a[ii][j + 1], a[ii][i]);
                break;
            }
        }
        if (a[j + 1][j]) {
            const T s = 1 / a[j + 1][j];
            for (int i = j + 2; i < n; ++i) {
                const T t = s * a[i][j];
                for (int jj = j; jj < n; ++jj)
                    a[i][jj] -= t * a[j + 1][jj];
                for (int ii = 0; ii < n; ++ii)
                    a[ii][j + 1] += t * a[ii][i];
            }
        }
    }
    // fss[i] := det(a[0..i][0..i] + x I_i)
    vector<vector<T>> fss(n + 1);
    fss[0] = {1};
    for (int i = 0; i < n; ++i) {
        fss[i + 1].assign(i + 2, 0);
        for (int k = 0; k <= i; ++k)
            fss[i + 1][k + 1] = fss[i][k];
        for (int k = 0; k <= i; ++k)
            fss[i + 1][k] += a[i][i] * fss[i][k];
        T prod = 1;
        for (int j = i - 1; j >= 0; --j) {
            prod *= -a[j + 1][j];
            const T t = prod * a[j][i];
            for (int k = 0; k <= j; ++k)
                fss[i + 1][k] += t * fss[j][k];
        }
    }
    return fss[n];
}

template <class T> vector<T> detPoly(vector<vector<T>> a, vector<vector<T>> b) {
    const int n = a.size();
    T prod = 1;
    int off = 0;
    for (int h = 0; h < n; ++h) {
        for (;;) {
            if (b[h][h])
                break;
            for (int j = h + 1; j < n; ++j) {
                if (b[h][j]) {
                    prod *= -1;
                    for (int i = 0; i < n; ++i) {
                        swap(a[i][h], a[i][j]);
                        swap(b[i][h], b[i][j]);
                    }
                    break;
                }
            }
            if (b[h][h])
                break;
            if (++off > n)
                return vector<T>(n + 1, 0);
            for (int j = 0; j < n; ++j) {
                b[h][j] = a[h][j];
                a[h][j] = 0;
            }
            for (int i = 0; i < h; ++i) {
                const T t = b[h][i];
                for (int j = 0; j < n; ++j) {
                    a[h][j] -= t * a[i][j];
                    b[h][j] -= t * b[i][j];
                }
            }
        }
        prod *= b[h][h];
        const T s = 1 / b[h][h];
        for (int j = 0; j < n; ++j) {
            a[h][j] *= s;
            b[h][j] *= s;
        }
        for (int i = 0; i < n; ++i)
            if (h != i) {
                const T t = b[i][h];
                for (int j = 0; j < n; ++j) {
                    a[i][j] -= t * a[h][j];
                    b[i][j] -= t * b[h][j];
                }
            }
    }
    const vector<T> fs = charPoly(a);
    vector<T> gs(n + 1, 0);
    for (int i = 0; off + i <= n; ++i)
        gs[i] = prod * fs[off + i];
    return gs;
}

using MInt = ModInt<998244353>;

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> p(n);
    for (auto& i : p)
        cin >> i;
    vector<vector<MInt>> a(n, vector<MInt>(n, 0));
    auto b = a;
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j) {
            if (p[i] > p[j]) {
                b[i][i] += 1;
                b[j][j] += 1;
                b[i][j] -= 1;
                b[j][i] -= 1;
            } else {
                a[i][i] += 1;
                a[j][j] += 1;
                a[i][j] -= 1;
                a[j][i] -= 1;
            }
        }
    a.resize(n - 1);
    b.resize(n - 1);
    for (auto& i : a)
        i.resize(n - 1);
    for (auto& i : b)
        i.resize(n - 1);
    auto ans = detPoly(a, b);
    for (auto& i : ans)
        cout << i << ' ';

    return 0;
}


到了这里,关于AtCoder Beginner Contest 323的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • AtCoder Beginner Contest 342

    给定一个字符串,两个字符,其中一个只出现一次,找出它的下标。 看第一个字符出现次数,如果是 (1) 则就是它,否则就是 不是它的字符 。 神奇的代码 一排人。 (m) 个询问,每个询问问两个人,谁在左边。 记录一下每个人的下标,然后对于每个询问比较下标大小即可

    2024年03月09日
    浏览(35)
  • AtCoder Beginner Contest 340

    给定等差数列的 首项 、 末项 、 公差 。 输出这个等差数列。 从 首相 依次累加 公差 到 末项 即可。 神奇的代码 依次进行 (Q) 次操作,分两种。 1 x ,将 x 放到数组 (a) 的末尾。 2 k ,输出数组 (a) 的倒数第 (k) 项。 用 vector 模拟即可,操作 2 可快速寻址访问。 神奇的代

    2024年02月19日
    浏览(6)
  • AtCoder Beginner Contest 304

    依次给定每个人的姓名和年龄,排成一圈。从年龄最小的人依次输出姓名。 找到年龄最小的,依次输出就好了。 神奇的代码 给定一个数字,如果其超过三位数,则仅保留其最高三位,低位数字全部置为0。 读一个 string ,直接赋值即可。 神奇的代码 给定 (n) 个人的坐标,第

    2024年02月07日
    浏览(12)
  • AtCoder Beginner Contest 303

    给定两个字符串,问这两个字符串是否相似。 两个字符串相似,需要每个字母,要么完全相同,要么一个是 1 一个是 l ,要么一个是 0 一个是 o 按照题意模拟即可。 可以将全部 1 换成 l ,全部 0 换成 o ,再判断相等。 神奇的代码 给定 m 个 n 的排列,问有多少对 ((i, j),i j

    2024年02月07日
    浏览(15)
  • AtCoder Beginner Contest 305

    给定一个数字 (x) ,输出一个数字,它是最接近 (x) 的 (5) 的倍数。 令 (y = x % 5) ,如果 (y leq 2) ,那答案就是 (x - y) ,否则就是 (x + 5 - y) 。 神奇的代码 给定 (ABCDEFG) 的相邻距离,给定两个字母,问它们的距离。 累加距离即可。 神奇的代码 二维平面,有一个矩形

    2024年02月08日
    浏览(24)
  • AtCoder Beginner Contest 339

    给一个网址,问它的后缀是多少。 找到最后的\\\'.\\\'的位置,然后输出后面的字符串即可。 python 可以一行。 神奇的代码 二维网格,上下左右相连,左上原点。初始全部为白色,位于原点,面朝上。 进行 (n) 次操作,每次操作,将当前格子颜色黑白反转,然后 如果原来是白色

    2024年02月19日
    浏览(13)
  • AtCoder Beginner Contest 336

    给定一个数 (n) ,将 long 中的 o 重复 (n) 次后输出。 模拟即可。 神奇的代码 给定一个数 (n) ,问 (n) 的二进制表示下的末尾零的数量。 即找到最小的 (i) 使得 (n (1 i)) 不为零的位置。枚举即可。 或者直接用内置函数 __builtin_ctz 。(count tail zero? 神奇的代码 定义一个数

    2024年01月20日
    浏览(37)
  • AtCoder Beginner Contest 328

    给定 (n) 个数字和一个数 (x) 。 问不大于 (x) 的数的和。 按找要求累计符合条件的数的和即可。 神奇的代码 给定一年的月数和一个月的天数。 问有多少对 ((i,j)) ,表示第 (i) 个月的第 (j) 日, (i,j) 的数位上每个数字都是一样的。 范围只有 (O(100^2)) ,枚举所有的

    2024年02月05日
    浏览(33)
  • AtCoder Beginner Contest 308

    这几天在收拾东西搬家,先附上代码,晚点补上题解 补完了 感觉这次FG都写不太明白 给定八个数,问是否满足以下要求: 不严格升序 每个数在 (100 sim 675) 之间 每个数都是 (25) 的倍数 依次对每个数判断是否符合这三个条件即可。 神奇的代码 高桥吃 (n) 份寿司,寿司分

    2024年02月11日
    浏览(33)
  • AtCoder Beginner Contest 318

    咕咕咕,总力战还没打,凹不过卷狗,躺了.jpg 给定 (n, m, p) ,问有多少个 (i) 满足 (0 m+pi leq n) 减去初始的 (m) ,剩下的就是看 (p) 的倍数个数。 神奇的代码 一个二维空间,有 (n) 个矩形覆盖。 问有多大的空间被覆盖了。重复覆盖算一次。 空间大小只有 (100) ,矩形

    2024年02月10日
    浏览(55)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包