結果

問題 No.8124 A+B
コンテスト
ユーザー 👑 獅子座じゃない人
提出日時 2026-04-01 22:40:01
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 17,015 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,172 ms
コンパイル使用メモリ 380,452 KB
実行使用メモリ 388,296 KB
最終ジャッジ日時 2026-04-01 22:40:14
合計ジャッジ時間 7,120 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 4 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#define USE_AC_LIBRARY

#ifndef USE_AC_LIBRARY
#include <bits/stdc++.h>
#elif defined(ONLINE_JUDGE)
#include <bits/stdc++.h>

#include <atcoder/all>
#else
#include <precompile.hpp>
#endif

using namespace std;
using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;

namespace atcoder {};
using namespace atcoder;
namespace suisen {};
using namespace suisen;
// cp-library-cpp

#ifdef ATCODER_MODINT_HPP
using mint = modint;
#endif

#define rep_kind(a, b, c, d, e, ...) e
#define rep1(i, r) for (int i = 0; i < (int)(r); ++i)
#define rep2(i, l, r) for (int i = (l); i < (int)(r); ++i)
#define rep3(i, l, r, d) for (int i = (l); i < (int)(r); i += (d))
#define rep_r1(i, r) for (int i = (r) - 1; i >= 0; --i)
#define rep_r2(i, l, r) for (int i = (r) - 1; i >= (l); --i)
#define rep_r3(i, l, r, d) for (int i = (r) - 1; i >= (l); i -= (d))
#define rep(...) rep_kind(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
#define rep_r(...) rep_kind(__VA_ARGS__, rep_r3, rep_r2, rep_r1)(__VA_ARGS__)

#define rep_t_kind(a, b, c, d, e, f, ...) f
#define rep_t1(type, i, r) for (type i = 0; i < (type)(r); ++i)
#define rep_t2(type, i, l, r) for (type i = (l); i < (type)(r); ++i)
#define rep_t3(type, i, l, r, d) for (type i = (l); i < (type)(r); i += (d))
#define rep_t_r1(type, i, r) for (type i = (r) - 1; i >= 0; --i)
#define rep_t_r2(type, i, l, r) for (type i = (r) - 1; i >= (l); --i)
#define rep_t_r3(type, i, l, r, d) for (type i = (r) - 1; i >= (l); i -= (d))
#define rep_t(...) rep_t_kind(__VA_ARGS__, rep_t3, rep_t2, rep_t1)(__VA_ARGS__)
#define rep_t_r(...)                                                           \
    rep_t_kind(__VA_ARGS__, rep_t_r3, rep_t_r2, rep_t_r1)(__VA_ARGS__)

#define do_while_kind(a, b, c, ...) c
#define do_while1(cond)                                                        \
    for (bool is_first = true; is_first || (cond); is_first = false)
#define do_while2(cond, is_first)                                              \
    for (bool is_first = true, is_first || (cond); is_first = false)
#define do_while(...)                                                          \
    do_while_kind(__VA_ARGS__, do_while2, do_while1)(__VA_ARGS__)

#ifdef ATCODER_MODINT_HPP
template <int M> istream &operator>>(istream &is, static_modint<M> &x) {
    ll val;
    is >> val;
    x = val;
    return is;
}
template <int M> ostream &operator<<(ostream &os, const static_modint<M> &x) {
    os << x.val();
    return os;
}

template <int id> istream &operator>>(istream &is, dynamic_modint<id> &x) {
    ll val;
    is >> val;
    x = val;
    return is;
}
template <int id>
ostream &operator<<(ostream &os, const dynamic_modint<id> &x) {
    os << x.val();
    return os;
}
#endif

inline int slot_index() {
    static int idx = ios_base::xalloc();
    return idx;
}
struct separator {
    string s;
};
inline separator sep(string s) { return {std::move(s)}; }
inline void cleanup(ios_base::event ev, ios_base &ios, int idx) {
    if (ev == ios_base::erase_event || ev == ios_base::copyfmt_event) {
        void *&slot = ios.pword(idx);
        delete static_cast<string *>(slot);
        slot = nullptr;
    }
}
inline ostream &operator<<(ostream &os, const separator &m) {
    void *&slot = os.pword(slot_index());
    if (!slot) {
        slot = new string(m.s);
        os.register_callback(&cleanup, slot_index());
    } else {
        *static_cast<string *>(slot) = m.s;
    }
    return os;
}
inline const char *current_sep(ios_base &ios) {
    if (auto p = static_cast<string *>(ios.pword(slot_index())); p) {
        return p->c_str();
    }
    return " ";
}

template <class T1, class T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << current_sep(os) << p.second;
    return os;
}

template <class T1, class T2, class T3>
istream &operator>>(istream &is, tuple<T1, T2, T3> &t3) {
    is >> get<0>(t3) >> get<1>(t3) >> get<2>(t3);
    return is;
}
template <class T1, class T2, class T3>
ostream &operator<<(ostream &os, const tuple<T1, T2, T3> &t3) {
    os << get<0>(t3) << current_sep(os) << get<1>(t3) << current_sep(os)
       << get<2>(t3);
    return os;
}

template <class T>
concept char_range = ranges::input_range<T> &&
                     same_as<remove_cv_t<ranges::range_value_t<T>>, char>;

template <class T>
concept nonstring_range =
    (ranges::input_range<T> || ranges::input_range<const T>) &&
    !is_convertible_v<T, string_view> && !char_range<T> && !char_range<const T>;

template <nonstring_range T> istream &operator>>(istream &is, T &r) {
    for (auto &e : r) {
        is >> e;
    }
    return is;
}
template <nonstring_range T> ostream &operator<<(ostream &os, const T &r) {
    bool is_first = true;
    for (auto &e : r) {
        if (is_first) {
            is_first = false;
        } else {
            os << current_sep(os);
        }
        os << e;
    }
    return os;
}

template <class... T> void in(T &...args) { (cin >> ... >> args); }
template <class... T> void in_z(T &...args) {
    (cin >> ... >> args);
    (..., --args);
}
#define in_d(type, ...)                                                        \
    type __VA_ARGS__;                                                          \
    in(__VA_ARGS__)
#define in_dz(type, ...)                                                       \
    type __VA_ARGS__;                                                          \
    in_z(__VA_ARGS__)

template <bool do_flush = false, class Hd, class... Tl>
void out(const Hd &hd, const Tl &...tl) {
    cout << hd;
    if constexpr (sizeof...(Tl)) {
        (cout << ... << (cout << current_sep(cout), tl));
    }
    cout << endl;
    if (do_flush) {
        cout << flush;
    }
}

template <bool do_flush = false, class Hd, class... Tl>
void err(const Hd &hd, const Tl &...tl) {
    cerr << hd;
    if constexpr (sizeof...(Tl)) {
        (cerr << ... << (cerr << current_sep(cerr), tl));
    }
    cerr << endl;
    if (do_flush) {
        cerr << flush;
    }
}

auto &out_sep(string s) { return cout << sep(s); }
auto &err_sep(string s) { return cerr << sep(s); }

auto &out_sep_ln() { return out_sep("\n"); }
auto &err_sep_ln() { return err_sep("\n"); }

#define dir_2(dx, dy) for (auto [dx, dy] : {pair{1, 0}, {0, 1}})
#define dir(dx, dy) for (auto [dx, dy] : {pair{1, 0}, {0, 1}, {-1, 0}, {0, -1}})
#define dir_8(dx, dy)                                                          \
    for (auto [dx, dy] : {pair{1, 0},                                          \
                          {1, 1},                                              \
                          {0, 1},                                              \
                          {-1, 1},                                             \
                          {-1, 0},                                             \
                          {-1, -1},                                            \
                          {0, -1},                                             \
                          {1, -1}})

#define all(v) (v).begin(), (v).end()
#define all_r(v) (v).rbegin(), (v).rend()
#define iter(v, l, r) ((v).begin() + l), ((v).begin() + r)

#define dedup(v) (v).erase(unique(all(v)), (v).end())

#define yn(b) ((b) ? "Yes" : "No")
#define yes() yn(true)
#define no() yn(false)

template <class T1, class T2> bool chmin(T1 &l, const T2 &r) {
    if (r < l) {
        l = r;
        return true;
    }
    return false;
}
template <class T1, class T2> bool chmax(T1 &l, const T2 &r) {
    if (r > l) {
        l = r;
        return true;
    }
    return false;
}

template <class T> void increment(T &v) {
    for (auto &e : v) {
        ++e;
    }
}
template <class T> void decrement(T &v) {
    for (auto &e : v) {
        --e;
    }
}

template <class It> iterator_traits<It>::value_type sum_of(It first, It last) {
    using T = iterator_traits<It>::value_type;
    return accumulate(first, last, T{});
}
template <class It, class U>
iterator_traits<It>::value_type sum_of(It first, It last, U init) {
    using T = iterator_traits<It>::value_type;
    return accumulate(first, last, T(init));
}

template <class Hd1, class Hd2, class... Tl>
auto min_of(Hd1 hd1, Hd2 hd2, Tl... tl) {
    if constexpr (sizeof...(Tl) == 0) {
        return min(hd1, hd2);
    } else {
        return min(hd1, min_of(hd2, tl...));
    }
}
template <class Hd1, class Hd2, class... Tl>
auto max_of(Hd1 hd1, Hd2 hd2, Tl... tl) {
    if constexpr (sizeof...(Tl) == 0) {
        return max(hd1, hd2);
    } else {
        return max(hd1, max_of(hd2, tl...));
    }
}
template <class Hd1, class Hd2, class... Tl>
auto gcd_of(Hd1 hd1, Hd2 hd2, Tl... tl) {
    if constexpr (sizeof...(Tl) == 0) {
        return gcd(hd1, hd2);
    } else {
        return gcd(hd1, gcd_of(hd2, tl...));
    }
}
template <class Hd1, class Hd2, class... Tl>
auto lcm_of(Hd1 hd1, Hd2 hd2, Tl... tl) {
    if constexpr (sizeof...(Tl) == 0) {
        return lcm(hd1, hd2);
    } else {
        return lcm(hd1, lcm_of(hd2, tl...));
    }
}

template <class T, size_t N>
auto make_vector(vector<size_t> &sizes, T const &x) {
    if constexpr (N == 1) {
        return vector(sizes[0], x);
    } else {
        size_t size = sizes[N - 1];
        sizes.pop_back();
        return vector(size, make_vector<T, N - 1>(sizes, x));
    }
}
template <class T, size_t N>
auto make_vector(size_t const (&sizes)[N], T const &x = T()) {
    vector<size_t> s(N);
    rep(i, N) { s[i] = sizes[N - i - 1]; }
    return make_vector<T, N>(s, x);
}
template <class T, size_t N> auto make_vector(vector<int> &sizes, T const &x) {
    if constexpr (N == 1) {
        return vector(sizes[0], x);
    } else {
        int size = sizes[N - 1];
        sizes.pop_back();
        return vector(size, make_vector<T, N - 1>(sizes, x));
    }
}
template <class T, size_t N>
auto make_vector(int const (&sizes)[N], T const &x = T()) {
    vector<int> s(N);
    rep(i, N) { s[i] = sizes[N - i - 1]; }
    return make_vector<T, N>(s, x);
}
template <class T, size_t Hd, size_t... Tl> auto make_array() {
    if constexpr (sizeof...(Tl) == 0) {
        return array<T, Hd>{};
    } else {
        return array<decltype(make_array<T, Tl...>()), Hd>{};
    }
}

constexpr int inf32 = 1'000'000'001;
constexpr ll inf64 = 2'000'000'000'000'000'001;

constexpr ll ten_powers[19] = {1,
                               10,
                               100,
                               1000,
                               10000,
                               100000,
                               1000000,
                               10000000,
                               100000000,
                               1000000000,
                               10000000000,
                               100000000000,
                               1000000000000,
                               10000000000000,
                               100000000000000,
                               1000000000000000,
                               10000000000000000,
                               100000000000000000,
                               1000000000000000000};

constexpr ll two_powers[63] = {1,
                               2,
                               4,
                               8,
                               16,
                               32,
                               64,
                               128,
                               256,
                               512,
                               1024,
                               2048,
                               4096,
                               8192,
                               16384,
                               32768,
                               65536,
                               131072,
                               262144,
                               524288,
                               1048576,
                               2097152,
                               4194304,
                               8388608,
                               16777216,
                               33554432,
                               67108864,
                               134217728,
                               268435456,
                               536870912,
                               1073741824,
                               2147483648,
                               4294967296,
                               8589934592,
                               17179869184,
                               34359738368,
                               68719476736,
                               137438953472,
                               274877906944,
                               549755813888,
                               1099511627776,
                               2199023255552,
                               4398046511104,
                               8796093022208,
                               17592186044416,
                               35184372088832,
                               70368744177664,
                               140737488355328,
                               281474976710656,
                               562949953421312,
                               1125899906842624,
                               2251799813685248,
                               4503599627370496,
                               9007199254740992,
                               18014398509481984,
                               36028797018963968,
                               72057594037927936,
                               144115188075855872,
                               288230376151711744,
                               576460752303423488,
                               1152921504606846976,
                               2305843009213693952,
                               4611686018427387904};

template <class T> using pq_greater = priority_queue<T, vector<T>, greater<>>;

template <class S, S e> constexpr S e_const() { return e; }
template <class S1, S1 e1, class S2, S2 e2> constexpr pair<S1, S2> e_pair() {
    return {e1, e2};
}
template <class S> S op_min(S a, S b) { return min(a, b); }
template <class S> S op_max(S a, S b) { return max(a, b); }
template <class S> S op_add(S a, S b) { return a + b; }
template <class S1, class S2>
pair<S1, S2> op_add_pair(pair<S1, S2> a, pair<S1, S2> b) {
    auto [a1, a2] = a;
    auto [b1, b2] = b;
    return {a1 + b1, a2 + b2};
}
template <class F1, class F2, class S> S mapping_affine(pair<F1, F2> f, S x) {
    auto [a, b] = f;
    return a * x + b;
}
template <class F1, class F2, class S1, class S2>
pair<S1, S2> mapping_len_and_affine(pair<F1, F2> f, pair<S1, S2> x) {
    auto [a, b] = f;
    auto [x1, x2] = x;
    return {x1, a * x2 + b * x1};
}
template <class F1, class F2>
pair<F1, F2> composition_affine(pair<F1, F2> f, pair<F1, F2> g) {
    auto [a_f, b_f] = f;
    auto [a_g, b_g] = g;
    return {a_f * a_g, a_f * b_g + b_f};
}

template <class M, class S, S e> constexpr M mint_const() { return M(e); }
template <class M1, class S1, S1 e1, class M2, class S2, S2 e2>
constexpr pair<M1, M2> mint_pair() {
    return {M1(e1), M2(e2)};
}

#ifdef ATCODER_SEGTREE_HPP
template <class S, S e>
using segtree_min = segtree<S, op_min<S>, e_const<S, e>>;
template <class S, S e>
using segtree_max = segtree<S, op_max<S>, e_const<S, e>>;
template <class S> using segtree_add = segtree<S, op_add<S>, e_const<S, 0>>;
template <class M, class S = int>
using segtree_add_mint = segtree<M, op_add<M>, mint_const<M, S, 0>>;
#endif

#ifdef ATCODER_LAZYSEGTREE_HPP
template <class S, S e>
using lazy_segtree_min =
    lazy_segtree<S, op_min<S>, e_const<S, e>, pair<S, S>,
                 mapping_affine<S, S, S>, composition_affine<S, S>,
                 e_pair<S, 1, S, 0>>;
template <class S, S e>
using lazy_segtree_max =
    lazy_segtree<S, op_max<S>, e_const<S, e>, pair<S, S>,
                 mapping_affine<S, S, S>, composition_affine<S, S>,
                 e_pair<S, 1, S, 0>>;
template <class S>
using lazy_segtree_add =
    lazy_segtree<pair<int, S>, op_add_pair<int, S>, e_pair<int, 0, S, 0>,
                 pair<S, S>, mapping_len_and_affine<S, S, int, S>,
                 composition_affine<S, S>, e_pair<S, 1, S, 0>>;
template <class M, class S = int>
using lazy_segtree_add_mint =
    lazy_segtree<pair<int, M>, op_add_pair<int, M>,
                 mint_pair<int, int, 0, M, S, 0>, pair<M, M>,
                 mapping_len_and_affine<M, M, int, M>, composition_affine<M, M>,
                 mint_pair<M, S, 1, M, S, 0>>;
#endif

void solve() {
    in_d(int, a, b);
    assert(to_string(a).size() == to_string(b).size());
    out((a + b) % ten_powers[to_string(a).size()]);
}

int main(void) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(15);
    int t = 1;
    while (t--) {
        solve();
    }
    return 0;
}
0