嘤嘤嘤嘤嘤嘤嘤嘤嘤嘤嘤嘤嘤嘤嘤 40分

P1303 A*B Problem

Wangxiaolong666 @ 2022-12-08 21:05:28

#include <iostream>
using namespace std;
int main()
{
    long long a,b;
    cin>>a>>b;
    cout<<a*b;
    return 0;
}

by Katz @ 2022-12-08 21:06:18

你这怎么做啊


by Ruiqun2009 @ 2022-12-08 21:06:46

每个非负整数不超过 10^{\color{red}2000}


by Hisaishi_Kanade @ 2022-12-08 21:07:32

锐评一句,标题很傻逼


by Ruiqun2009 @ 2022-12-08 21:07:53

话说这题不 FFT 裸题吗


by Katz @ 2022-12-08 21:08:11

@bye_wjx 好骂


by Ruiqun2009 @ 2022-12-08 21:10:15

c++17

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string.h>
#include <type_traits>
#include <unordered_map>
#if __cplusplus < 201703L
namespace std {
template <typename _Tp>
  constexpr bool is_void_v = is_void<_Tp>::value;
template <typename _Tp>
  constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
template <typename _Tp>
  constexpr bool is_integral_v = is_integral<_Tp>::value;
template <typename _Tp>
  constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
template <typename _Tp>
  constexpr bool is_array_v = is_array<_Tp>::value;
template <typename _Tp>
  constexpr bool is_pointer_v = is_pointer<_Tp>::value;
template <typename _Tp>
  constexpr bool is_lvalue_reference_v =
    is_lvalue_reference<_Tp>::value;
template <typename _Tp>
  constexpr bool is_rvalue_reference_v =
    is_rvalue_reference<_Tp>::value;
template <typename _Tp>
  constexpr bool is_member_object_pointer_v =
    is_member_object_pointer<_Tp>::value;
template <typename _Tp>
  constexpr bool is_member_function_pointer_v =
    is_member_function_pointer<_Tp>::value;
template <typename _Tp>
  constexpr bool is_enum_v = is_enum<_Tp>::value;
template <typename _Tp>
  constexpr bool is_union_v = is_union<_Tp>::value;
template <typename _Tp>
  constexpr bool is_class_v = is_class<_Tp>::value;
template <typename _Tp>
  constexpr bool is_function_v = is_function<_Tp>::value;
template <typename _Tp>
  constexpr bool is_reference_v = is_reference<_Tp>::value;
template <typename _Tp>
  constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
template <typename _Tp>
  constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
template <typename _Tp>
  constexpr bool is_object_v = is_object<_Tp>::value;
template <typename _Tp>
  constexpr bool is_scalar_v = is_scalar<_Tp>::value;
template <typename _Tp>
  constexpr bool is_compound_v = is_compound<_Tp>::value;
template <typename _Tp>
  constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
template <typename _Tp>
  constexpr bool is_const_v = is_const<_Tp>::value;
template <typename _Tp>
  constexpr bool is_volatile_v = is_volatile<_Tp>::value;
template <typename _Tp>
  constexpr bool is_trivial_v = is_trivial<_Tp>::value;
template <typename _Tp>
  constexpr bool is_trivially_copyable_v =
    is_trivially_copyable<_Tp>::value;
template <typename _Tp>
  constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
template <typename _Tp>
  constexpr bool is_pod_v = is_pod<_Tp>::value;
template <typename _Tp>
  constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
template <typename _Tp>
  constexpr bool is_empty_v = is_empty<_Tp>::value;
template <typename _Tp>
  constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
template <typename _Tp>
  constexpr bool is_abstract_v = is_abstract<_Tp>::value;
template <typename _Tp>
  constexpr bool is_final_v = is_final<_Tp>::value;
template <typename _Tp>
  constexpr bool is_signed_v = is_signed<_Tp>::value;
template <typename _Tp>
  constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
template <typename _Tp, typename... _Args>
  constexpr bool is_constructible_v =
    is_constructible<_Tp, _Args...>::value;
template <typename _Tp>
  constexpr bool is_default_constructible_v =
    is_default_constructible<_Tp>::value;
template <typename _Tp>
  constexpr bool is_copy_constructible_v =
    is_copy_constructible<_Tp>::value;
template <typename _Tp>
  constexpr bool is_move_constructible_v =
    is_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
  constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value;
template <typename _Tp>
  constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
template <typename _Tp>
  constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
template <typename _Tp>
  constexpr bool is_destructible_v = is_destructible<_Tp>::value;
template <typename _Tp, typename... _Args>
  constexpr bool is_trivially_constructible_v =
    is_trivially_constructible<_Tp, _Args...>::value;
template <typename _Tp>
  constexpr bool is_trivially_default_constructible_v =
    is_trivially_default_constructible<_Tp>::value;
template <typename _Tp>
  constexpr bool is_trivially_copy_constructible_v =
    is_trivially_copy_constructible<_Tp>::value;
template <typename _Tp>
  constexpr bool is_trivially_move_constructible_v =
    is_trivially_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
  constexpr bool is_trivially_assignable_v =
    is_trivially_assignable<_Tp, _Up>::value;
template <typename _Tp>
  constexpr bool is_trivially_copy_assignable_v =
    is_trivially_copy_assignable<_Tp>::value;
template <typename _Tp>
  constexpr bool is_trivially_move_assignable_v =
    is_trivially_move_assignable<_Tp>::value;
template <typename _Tp>
  constexpr bool is_trivially_destructible_v =
    is_trivially_destructible<_Tp>::value;
template <typename _Tp, typename... _Args>
  constexpr bool is_nothrow_constructible_v =
    is_nothrow_constructible<_Tp, _Args...>::value;
template <typename _Tp>
  constexpr bool is_nothrow_default_constructible_v =
    is_nothrow_default_constructible<_Tp>::value;
template <typename _Tp>
  constexpr bool is_nothrow_copy_constructible_v =
    is_nothrow_copy_constructible<_Tp>::value;
template <typename _Tp>
  constexpr bool is_nothrow_move_constructible_v =
    is_nothrow_move_constructible<_Tp>::value;
template <typename _Tp, typename _Up>
  constexpr bool is_nothrow_assignable_v =
    is_nothrow_assignable<_Tp, _Up>::value;
template <typename _Tp>
  constexpr bool is_nothrow_copy_assignable_v =
    is_nothrow_copy_assignable<_Tp>::value;
template <typename _Tp>
  constexpr bool is_nothrow_move_assignable_v =
    is_nothrow_move_assignable<_Tp>::value;
template <typename _Tp>
  constexpr bool is_nothrow_destructible_v =
    is_nothrow_destructible<_Tp>::value;
template <typename _Tp>
  constexpr bool has_virtual_destructor_v =
    has_virtual_destructor<_Tp>::value;
template <typename _Tp>
  constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
template <typename _Tp>
  constexpr size_t rank_v = rank<_Tp>::value;
template <typename _Tp, unsigned _Idx = 0>
  constexpr size_t extent_v = extent<_Tp, _Idx>::value;
#ifdef _GLIBCXX_BUILTIN_IS_SAME_AS
template <typename _Tp, typename _Up>
  constexpr bool is_same_v = _GLIBCXX_BUILTIN_IS_SAME_AS(_Tp, _Up);
#else
template <typename _Tp, typename _Up>
  constexpr bool is_same_v = std::is_same<_Tp, _Up>::value;
#endif
template <typename _Base, typename _Derived>
  constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
template <typename _From, typename _To>
  constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
}
#endif
inline namespace __my_detail {
#define cin __my_detail::inputHelper<524288, 32>::getInstance()
#define getchar() ({char c=cin.getChar_Checked();cin.next();c;})
#define cout __my_detail::outputHelper<8388608>::getInstance()
#define putchar cout.putChar
#define endl '\n'
#define putlog(...) __my_detail::printLog(", ", __VA_ARGS__)
    template <uint64_t _BufferSize = 524288, uint64_t _BlockSize = 32>
    class inputHelper {
        FILE *m_filePtr;
        char m_buf[_BufferSize], *m_end, *m_cursor;
        bool m_ok;
        void flush() {
            uint64_t a = m_end - m_cursor;
            if (a >= _BlockSize) return;
            memmove(m_buf, m_cursor, a);
            uint64_t b = fread(m_buf + a, 1, _BufferSize - a, m_filePtr);
            m_cursor = m_buf;
            if (a + b < _BufferSize) {
                m_end = m_buf + a + b;
                *m_end = EOF;
            }
        }

    public:
        explicit inputHelper(const char *inputFileName) : m_ok(true) {
            if (!*inputFileName)
                m_filePtr = stdin;
            else
                m_filePtr = fopen(inputFileName, "rt");
            m_end = m_cursor = m_buf + _BufferSize;
        }
        ~inputHelper() { fclose(m_filePtr); }
        static inputHelper<_BufferSize, _BlockSize> &getInstance() {
#ifdef OY_LOCAL
            static inputHelper<_BufferSize, _BlockSize> s_obj("in.txt");
#else
            static inputHelper<_BufferSize, _BlockSize> s_obj("");
#endif
            return s_obj;
        }
        static constexpr bool isBlank(char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; }
        static constexpr bool isEndline(char c) { return c == '\n' || c == EOF; }
        const char &getChar_Checked() {
            if (m_cursor < m_end) return *m_cursor;
            uint64_t b = fread(m_buf, 1, _BufferSize, m_filePtr);
            m_cursor = m_buf;
            if (b < _BufferSize) {
                m_end = m_buf + b;
                *m_end = EOF;
            }
            return *m_cursor;
        }
        const char &getChar_Unchecked() const { return *m_cursor; }
        void next() { ++m_cursor; }
        void setState(bool _ok) { m_ok = _ok; }
        template <typename _Tp, std::enable_if_t<std::is_signed_v<_Tp> & std::is_integral_v<_Tp>> * = nullptr>
        inputHelper<_BufferSize, _BlockSize> &operator>>(_Tp &ret) {
            while (isBlank(getChar_Checked())) next();
            flush();
            if (getChar_Unchecked() == '-') {
                next();
                if (isdigit(getChar_Unchecked())) {
                    ret = -(getChar_Unchecked() - '0');
                    while (next(), isdigit(getChar_Unchecked())) ret = ret * 10 - (getChar_Unchecked() - '0');
                } else
                    m_ok = false;
            } else {
                if (isdigit(getChar_Unchecked())) {
                    ret = getChar_Unchecked() - '0';
                    while (next(), isdigit(getChar_Unchecked())) ret = ret * 10 + (getChar_Unchecked() - '0');
                } else
                    m_ok = false;
            }
            return *this;
        }
        template <typename _Tp, std::enable_if_t<std::is_unsigned_v<_Tp> & std::is_integral_v<_Tp>> * = nullptr>
        inputHelper<_BufferSize, _BlockSize> &operator>>(_Tp &ret) {
            while (isBlank(getChar_Checked())) next();
            flush();
            if (isdigit(getChar_Unchecked())) {
                ret = getChar_Unchecked() - '0';
                while (next(), isdigit(getChar_Unchecked())) ret = ret * 10 + (getChar_Unchecked() - '0');
            } else
                m_ok = false;
            return *this;
        }
        template <typename _Tp, std::enable_if_t<std::is_floating_point_v<_Tp>> * = nullptr>
        inputHelper<_BufferSize, _BlockSize> &operator>>(_Tp &ret) {
            bool neg = false, integer = false, decimal = false;
            while (isBlank(getChar_Checked())) next();
            flush();
            if (getChar_Unchecked() == '-') {
                neg = true;
                next();
            }
            if (!isdigit(getChar_Unchecked()) && getChar_Unchecked() != '.') {
                m_ok = false;
                return *this;
            }
            if (isdigit(getChar_Unchecked())) {
                integer = true;
                ret = getChar_Unchecked() - '0';
                while (next(), isdigit(getChar_Unchecked())) ret = ret * 10 + (getChar_Unchecked() - '0');
            }
            if (getChar_Unchecked() == '.') {
                next();
                if (isdigit(getChar_Unchecked())) {
                    if (!integer) ret = 0;
                    decimal = true;
                    _Tp unit = 0.1;
                    ret += unit * (getChar_Unchecked() - '0');
                    while (next(), isdigit(getChar_Unchecked())) {
                        unit *= 0.1;
                        ret += unit * (getChar_Unchecked() - '0');
                    }
                }
            }
            if (!integer && !decimal)
                m_ok = false;
            else if (neg)
                ret = -ret;
            return *this;
        }
        inputHelper<_BufferSize, _BlockSize> &operator>>(char &ret) {
            while (isBlank(getChar_Checked())) next();
            ret = getChar_Checked();
            next();
            return *this;
        }
        inputHelper<_BufferSize, _BlockSize> &operator>>(std::string &ret) {
            while (isBlank(getChar_Checked())) next();
            if (getChar_Checked() != EOF) {
                ret.clear();
                do {
                    ret += getChar_Checked();
                    next();
                } while (!isBlank(getChar_Checked()) && getChar_Unchecked() != EOF);
            } else
                m_ok = false;
            return *this;
        }
        explicit operator bool() { return m_ok; }
    };
    template <uint64_t _BufferSize = 8388608>
    class outputHelper {
        FILE *m_filePtr = nullptr;
        char m_buf[_BufferSize], *m_end, *m_cursor;
        char m_tempBuf[50], *m_tempBufCursor, *m_tempBufDot;
        uint64_t m_floatReserve, m_floatRatio;

    public:
        outputHelper(const char *outputFileName, int prec = 6) : m_end(m_buf + _BufferSize) {
            if (!*outputFileName)
                m_filePtr = stdout;
            else
                m_filePtr = fopen(outputFileName, "wt");
            m_cursor = m_buf;
            m_tempBufCursor = m_tempBuf;
            precision(prec);
        }
        static outputHelper<_BufferSize> &getInstance() {
#ifdef OY_LOCAL
            static outputHelper<_BufferSize> s_obj("out.txt");
#else
            static outputHelper<_BufferSize> s_obj("");
#endif
            return s_obj;
        }
        ~outputHelper() {
            flush();
            fclose(m_filePtr);
        }
        void precision(int prec) {
            m_floatReserve = prec;
            m_floatRatio = pow(10, prec);
            m_tempBufDot = m_tempBuf + prec;
        }
        outputHelper<_BufferSize> &flush() {
            fwrite(m_buf, 1, m_cursor - m_buf, m_filePtr);
            fflush(m_filePtr);
            m_cursor = m_buf;
            return *this;
        }
        void putChar(const char &c) {
            if (m_cursor == m_end) flush();
            *m_cursor++ = c;
        }
        void putS(const char *c) {
            while (*c) putChar(*c++);
        }
        template <typename _Tp, std::enable_if_t<std::is_signed_v<_Tp> & std::is_integral_v<_Tp>> * = nullptr>
        outputHelper<_BufferSize> &operator<<(const _Tp &ret) {
            _Tp _ret = _Tp(ret);
            if (_ret >= 0) {
                do {
                    *m_tempBufCursor++ = '0' + _ret % 10;
                    _ret /= 10;
                } while (_ret);
                do putChar(*--m_tempBufCursor);
                while (m_tempBufCursor > m_tempBuf);
            } else {
                putChar('-');
                do {
                    *m_tempBufCursor++ = '0' - _ret % 10;
                    _ret /= 10;
                } while (_ret);
                do putChar(*--m_tempBufCursor);
                while (m_tempBufCursor > m_tempBuf);
            }
            return *this;
        }
        template <typename _Tp, std::enable_if_t<std::is_unsigned_v<_Tp> & std::is_integral_v<_Tp>> * = nullptr>
        outputHelper<_BufferSize> &operator<<(const _Tp &ret) {
            _Tp _ret = _Tp(ret);
            do {
                *m_tempBufCursor++ = '0' + _ret % 10;
                _ret /= 10;
            } while (_ret);
            do putChar(*--m_tempBufCursor);
            while (m_tempBufCursor > m_tempBuf);
            return *this;
        }
        template <typename _Tp, std::enable_if_t<std::is_floating_point_v<_Tp>> * = nullptr>
        outputHelper<_BufferSize> &operator<<(const _Tp &ret) {
            if (ret < 0) {
                putChar('-');
                return *this << -ret;
            }
            _Tp _ret = ret * m_floatRatio;
            uint64_t integer = _ret;
            if (_ret - integer >= 0.4999999999) integer++;
            do {
                *m_tempBufCursor++ = '0' + integer % 10;
                integer /= 10;
            } while (integer);
            if (m_tempBufCursor > m_tempBufDot) {
                do putChar(*--m_tempBufCursor);
                while (m_tempBufCursor > m_tempBufDot);
                putChar('.');
            } else {
                putS("0.");
                for (int i = m_tempBufDot - m_tempBufCursor; i--;) putChar('0');
            }
            do putChar(*--m_tempBufCursor);
            while (m_tempBufCursor > m_tempBuf);
            return *this;
        }
        outputHelper<_BufferSize> &operator<<(const char &ret) {
            putChar(ret);
            return *this;
        }
        outputHelper<_BufferSize> &operator<<(const std::string &ret) {
            putS(ret.data());
            return *this;
        }
    };
}
#define int long long
using std::vector;

const int mod = 104857601, g = 3, invg = (mod + 1) / g;
const int inv2 = (mod + 1) / 2, inv6 = (mod + 1) / 6;
const int imag = 10240;

inline int fpow(int base, int power) {
    base %= mod;
    int ans = 1;
    for (; power; base = base * base % mod, power >>= 1) 
    if (power & 1) ans = ans * base % mod;
    return ans;
}

static vector<int> rev;

inline void get_rev(int n) {
    for(int i = 1; i < n; i++) 
        rev[i] = (rev[i >> 1] >> 1) | ((i & 1) * (n >> 1));
}

inline void NTT(vector<int>& a, int len, bool dft = false)
{
    for (int i = 0; i < len; i++) 
        if (i < rev[i]) std::swap(a[i], a[rev[i]]);
    for (int i = 1; i < len; i <<= 1)
    {
        int gn = fpow(dft ? g : invg, (mod - 1) / (i << 1));
        for (int j = 0; j < len; j += (i << 1))
        {
            int g0 = 1;
            for (int k = 0; k < i; k++, g0 = g0 * gn % mod)
            {
                int x = a[j + k], y = g0 * a[i + j + k] % mod;
                a[j + k] = (x + y) % mod;
                a[i + j + k] = (x - y + mod) % mod;
            }
        }
    }
}

void mul(vector<int>& a, vector<int> b) {
    std::reverse(a.begin(), a.end());
    std::reverse(b.begin(), b.end());
    int n = a.size() + 1, m = b.size() + 1;
    int len = 1;
    while (len < n + m) len <<= 1;
    rev.resize(len);
    get_rev(len);
    a.resize(len);
    b.resize(len);
    NTT(a, len, 1);
    NTT(b, len, 1);
    for (int i = 0; i < len; i++) a[i] = a[i] * b[i] % mod;
    NTT(a, len, 0);
    a.resize(n + m - 1);
    int invn = fpow(len, mod - 2);
    for (size_t i = 0; i < a.size(); i++) a[i] = a[i] * invn % mod;
    std::reverse(a.begin(), a.end());
}

class UnsignedBigInteger {
    vector<int> m_iValue;
    void flatten();
    void flatten_for_subtract();
public:
    UnsignedBigInteger() {}
    explicit UnsignedBigInteger(unsigned int x) {
        if (x == 0) m_iValue.push_back(0);
        while (x) m_iValue.push_back(x % 10), x /= 10;
    }
    UnsignedBigInteger(vector<int> rOther) : m_iValue(rOther) {flatten(); }
    void print() {
        for (auto it = m_iValue.rbegin(); it != m_iValue.rend(); ++it) printf("%llu", *it);
    }
    void input() {
        int ch = getchar();
        while (!isdigit(ch)) ch = getchar();
        while (isdigit(ch)) m_iValue.push_back(ch - '0'), ch = getchar();
    }
    UnsignedBigInteger operator+(UnsignedBigInteger rOther) {
        vector<int> res = m_iValue;
        res.resize(std::max(m_iValue.size(), rOther.m_iValue.size()));
        for (size_t i = 0; i < rOther.m_iValue.size(); i++) {
            res[i] += rOther.m_iValue[i];
        }
        m_iValue = res;
        flatten();
        return *this;
    }
    UnsignedBigInteger operator-(UnsignedBigInteger rOther) {
        vector<int> res = m_iValue;
        res.resize(std::max(m_iValue.size(), rOther.m_iValue.size()));
        for (size_t i = 0; i < rOther.m_iValue.size(); i++) {
            res[i] -= rOther.m_iValue[i];
        }
        m_iValue = res;
        flatten_for_subtract();
        return *this;
    }
    bool operator<(const UnsignedBigInteger o) const {
        if (m_iValue.size() != o.m_iValue.size()) return m_iValue.size() < o.m_iValue.size();
        for (size_t i = 0; i < m_iValue.size(); i++) {
            if (m_iValue[i] != o.m_iValue[i]) return m_iValue[i] < o.m_iValue[i];
        }
        return false;
    }
    bool operator>(const UnsignedBigInteger rOther) const {
        return rOther < *this;
    }
    bool operator!=(const UnsignedBigInteger rOther) const {
        return (*this < rOther) || (rOther < *this);
    }
    bool operator==(const UnsignedBigInteger rOther) const {
        return !(*this != rOther);
    }
    UnsignedBigInteger operator*(UnsignedBigInteger rOther);
};
const UnsignedBigInteger zero(0u);
UnsignedBigInteger UnsignedBigInteger::operator*(UnsignedBigInteger rOther) {
    if (*this == zero || rOther == zero) return zero;
    mul(m_iValue, rOther.m_iValue);
    m_iValue = vector<int>(m_iValue.begin() + 2, m_iValue.end());
    this->flatten();
    return *this;
}
void UnsignedBigInteger::flatten() {
#define m_iValue this->m_iValue
    int inc = 0;
    for (size_t i = 0; i < m_iValue.size(); i++) {
        m_iValue[i] += inc;
        inc = m_iValue[i] / 10;
        m_iValue[i] %= 10;
    }
    if (inc) m_iValue.push_back(inc);
}
void UnsignedBigInteger::flatten_for_subtract() {
    for (size_t i = 0; i < m_iValue.size(); i++) {
        while (m_iValue[i] < 0) m_iValue[i] += 10, m_iValue[i + 1]--;
    }
#undef m_iValue
}
class BigInteger {
    bool isNegative;
    UnsignedBigInteger m_iValue;
public:
    BigInteger() : isNegative(false) {}
    explicit BigInteger(int x) : isNegative(x < 0), m_iValue((unsigned int)abs(x)) {}
private:
    explicit BigInteger(bool isN, UnsignedBigInteger x) : isNegative(isN), m_iValue(x) {}
public:
    BigInteger operator + (BigInteger b) {
        if(isNegative==b.isNegative) return BigInteger(isNegative,m_iValue+b.m_iValue);
        else if(m_iValue>b.m_iValue) return BigInteger(isNegative,m_iValue-b.m_iValue);
        else if(m_iValue<b.m_iValue) return BigInteger(b.isNegative,b.m_iValue-m_iValue);
        else return BigInteger(0);
    }
    void print() {
        if (isNegative) putchar('-');
        m_iValue.print();
    }
    BigInteger operator - (BigInteger b) {
        if(isNegative==b.isNegative) {
            if(m_iValue>b.m_iValue) return BigInteger(isNegative,m_iValue-b.m_iValue);
            else if(m_iValue<b.m_iValue) return BigInteger(!isNegative,b.m_iValue-m_iValue);
            else return BigInteger(1, UnsignedBigInteger(vector<int>(1, 0)));
        }
        else return BigInteger(isNegative,m_iValue+b.m_iValue);
    }
    BigInteger operator*(BigInteger b) {
        return BigInteger(isNegative ^ b.isNegative, m_iValue * b.m_iValue);
    }
    void input();
    void input(const vector<char> rOther);
};
void BigInteger::input() {
    auto ch = getchar();
    while (!isdigit(ch)) {
        isNegative |= (ch == '-');
        ch = getchar();
    }
    vector<int> res;
    while (isdigit(ch)) {
        res.push_back(ch - '0');
        ch = getchar();
    }
    reverse(res.begin(), res.end());
    m_iValue = res;
}
BigInteger x, y;
signed main() {
    x.input();
    y.input();
    x = x * y;
    x.print();
}

by Ruiqun2009 @ 2022-12-08 21:11:54

甚至没有预处理单位根和使用蒙哥马利取模器就能过(


by InversionShadow @ 2022-12-08 21:15:15

%%%


by DYYqwq @ 2022-12-08 21:16:39

a = int(input())
b = int(input())
print(a * b)

by DYYqwq @ 2022-12-08 21:17:19

@Wangxiaolong666


| 下一页