68 条题解

  • 1
    @ 2026-9-25 9:46:50

    看看最长的题解

    #include <iostream>
    #include <vector>
    #include <array>
    #include <cstdint>
    #include <string>
    #include <type_traits>
    
    namespace _0x7f8a {
    
    template<uint32_t _0x1a, uint32_t _0x2b>
    struct _0x9c4d {
        static constexpr uint32_t _0x3e = (_0x1a * 1664525u + 1013904223u);
        static constexpr uint8_t _0x4f = static_cast<uint8_t>(
            ((_0x3e >> ((_0x2b % 4) * 8)) ^ (_0x2b * 0x5Du + 0x27u)) & 0xFF
        );
    };
    
    template<uint64_t _0x51>
    struct _0x62a3 {
        static inline bool _0x73b4() noexcept {
            return ((_0x51 * (_0x51 + 1ULL)) & 1ULL) == 0ULL;
        }
    
        static inline bool _0x84c5() noexcept {
            return ((_0x51 * (_0x51 + 1ULL) * (_0x51 + 2ULL)) % 6ULL) == 0ULL;
        }
    
        static inline uint64_t _0x95d6(uint64_t _0xa6) noexcept {
            uint64_t _0xb7 = (_0x51 | (~_0x51)) + 1ULL;
            return _0xa6 ^ _0xb7;
        }
    };
    
    class _0xc8e7 {
    private:
        uint32_t _0xd9f8;
    
    public:
        explicit constexpr _0xc8e7(uint32_t _0xea09) : _0xd9f8(_0xea09) {}
    
        inline uint8_t _0xfb1a(size_t _0x0c2b) const noexcept {
            uint32_t _0x1d3c = (_0xd9f8 ^ (static_cast<uint32_t>(_0x0c2b) * 0x654321ABu));
            uint8_t _0x2e4d = static_cast<uint8_t>((_0x0c2b * 5) % 17);
            uint8_t _0x3f5e = static_cast<uint8_t>(_0x0c2b * 0x3Du + 0x87u);
            return static_cast<uint8_t>(((_0x1d3c >> _0x2e4d) ^ _0x3f5e) & 0xFF);
        }
    
        inline uint8_t _0x406f(uint8_t _0x517a, size_t _0x628b) const noexcept {
            return _0x517a ^ _0xfb1a(_0x628b);
        }
    };
    
    }
    
    class _0x739c {
    public:
        static inline uint64_t _0x84ad(uint64_t _0x95be, uint64_t _0xa6cf) noexcept {
            return (_0x95be | _0xa6cf) ^ (_0x95be ^ _0xa6cf);
        }
    
        static inline uint64_t _0xb7d0(uint64_t _0xc8e1, uint64_t _0xd9f2) noexcept {
            return (_0xc8e1 ^ _0xd9f2) ^ _0x84ad(_0xc8e1, _0xd9f2);
        }
    
        static inline uint64_t _0xea03(uint64_t _0xfb14) noexcept {
            return _0xfb14 ^ 0xFFFFFFFFFFFFFFFFULL;
        }
    
        static int64_t _0x0c25(int64_t _0x1d36, int64_t _0x2e47) noexcept {
            uint64_t _0x3f58 = static_cast<uint64_t>(_0x1d36);
            uint64_t _0x4069 = static_cast<uint64_t>(_0x2e47);
            uint32_t _0x517a = 0xAA01BB02u;
    
            while (_0x517a != 0x00000000u) {
                switch (_0x517a) {
                    case 0xAA01BB02u: {
                        if (_0x4069 == 0ULL) {
                            _0x517a = 0x00000000u;
                        } else {
                            _0x517a = 0xCC03DD04u;
                        }
                        break;
                    }
                    case 0xCC03DD04u: {
                        uint64_t _0x628b = _0x84ad(_0x3f58, _0x4069);
                        _0x3f58 = _0x3f58 ^ _0x4069;
                        _0x4069 = _0x628b << 1;
                        if (_0x7f8a::_0x62a3<0xCAFEBABEULL>::_0x73b4()) {
                            _0x517a = 0xAA01BB02u;
                        } else {
                            _0x517a = 0xDEAD0001u;
                        }
                        break;
                    }
                    case 0xDEAD0001u: {
                        _0x3f58 = _0x3f58 ^ 0xFEEDFACECAFEBEEFULL;
                        _0x517a = 0xAA01BB02u;
                        break;
                    }
                    default: {
                        _0x517a = 0x00000000u;
                        break;
                    }
                }
            }
            return static_cast<int64_t>(_0x7f8a::_0x62a3<0x12345678ULL>::_0x95d6(_0x3f58));
        }
    
        static inline int64_t _0x739c_neg(int64_t _0x84ad_val) noexcept {
            uint64_t _0x95be_inv = _0xea03(static_cast<uint64_t>(_0x84ad_val));
            return _0x0c25(static_cast<int64_t>(_0x95be_inv), 1);
        }
    
        static inline int64_t _0xa6cf_sub(int64_t _0xb7d0_m, int64_t _0xc8e1_s) noexcept {
            return _0x0c25(_0xb7d0_m, _0x739c_neg(_0xc8e1_s));
        }
    
        static inline int64_t _0xd9f2_mul10(int64_t _0xea03_v) noexcept {
            int64_t _0xfb14_t1 = _0xea03_v << 3;
            int64_t _0x0c25_t2 = _0xea03_v << 1;
            return _0x0c25(_0xfb14_t1, _0x0c25_t2);
        }
    };
    
    class _0x1d36_io {
    public:
        static int64_t _0x2e47_read() noexcept {
            int64_t _0x3f58_acc = 0;
            int64_t _0x4069_sgn = 1;
            int _0x517a_ch = 0;
            uint32_t _0x628b_st = 0x10203040u;
    
            while (_0x628b_st != 0xF0E0D0C0u) {
                switch (_0x628b_st) {
                    case 0x10203040u: {
                        _0x517a_ch = std::cin.get();
                        if (!std::cin.good()) {
                            _0x628b_st = 0xF0E0D0C0u;
                            break;
                        }
                        if (_0x517a_ch == 0x20 || _0x517a_ch == 0x0A || _0x517a_ch == 0x0D || _0x517a_ch == 0x09) {
                            _0x628b_st = 0x10203040u;
                        } else if (_0x517a_ch == 0x2D) {
                            _0x4069_sgn = -1;
                            _0x628b_st = 0x20304050u;
                        } else if (_0x517a_ch >= 0x30 && _0x517a_ch <= 0x39) {
                            _0x3f58_acc = static_cast<int64_t>(_0x517a_ch ^ 0x30);
                            _0x628b_st = 0x20304050u;
                        } else {
                            _0x628b_st = 0x10203040u;
                        }
                        break;
                    }
                    case 0x20304050u: {
                        _0x517a_ch = std::cin.get();
                        if (_0x517a_ch >= 0x30 && _0x517a_ch <= 0x39) {
                            int64_t _0x739c_d = static_cast<int64_t>(_0x517a_ch ^ 0x30);
                            int64_t _0x84ad_s = _0x739c::_0xd9f2_mul10(_0x3f58_acc);
                            _0x3f58_acc = _0x739c::_0x0c25(_0x84ad_s, _0x739c_d);
                            _0x628b_st = 0x20304050u;
                        } else {
                            _0x628b_st = 0xF0E0D0C0u;
                        }
                        break;
                    }
                    default: {
                        _0x628b_st = 0xF0E0D0C0u;
                        break;
                    }
                }
            }
    
            if (_0x4069_sgn < 0) {
                _0x3f58_acc = _0x739c::_0x739c_neg(_0x3f58_acc);
            }
            return _0x3f58_acc;
        }
    
        static void _0x95be_write(int64_t _0xa6cf_val) noexcept {
            if (_0xa6cf_val == 0) {
                std::cout.put(static_cast<char>(0x30 ^ 0x00));
                std::cout.put('\n');
                return;
            }
    
            uint32_t _0xb7d0_st = 0x8192A3B4u;
            char _0xc8e1_buf[32];
            int _0xd9f2_idx = 0;
            int64_t _0xea03_cur = _0xa6cf_val;
    
            while (_0xb7d0_st != 0x0F1E2D3Cu) {
                switch (_0xb7d0_st) {
                    case 0x8192A3B4u: {
                        if (_0xea03_cur < 0) {
                            std::cout.put(static_cast<char>(0x2D));
                            _0xea03_cur = _0x739c::_0x739c_neg(_0xea03_cur);
                        }
                        _0xb7d0_st = 0x4B3A2918u;
                        break;
                    }
                    case 0x4B3A2918u: {
                        if (_0xea03_cur > 0) {
                            int64_t _0xfb14_rem = _0xea03_cur % 10;
                            _0xc8e1_buf[_0xd9f2_idx] = static_cast<char>(_0xfb14_rem ^ 0x30);
                            _0xd9f2_idx = static_cast<int>(_0x739c::_0x0c25(_0xd9f2_idx, 1));
                            _0xea03_cur /= 10;
                            _0xb7d0_st = 0x4B3A2918u;
                        } else {
                            _0xb7d0_st = 0x5C4D3E2Fu;
                        }
                        break;
                    }
                    case 0x5C4D3E2Fu: {
                        if (_0xd9f2_idx > 0) {
                            _0xd9f2_idx = static_cast<int>(_0x739c::_0xa6cf_sub(_0xd9f2_idx, 1));
                            std::cout.put(_0xc8e1_buf[_0xd9f2_idx]);
                            _0xb7d0_st = 0x5C4D3E2Fu;
                        } else {
                            std::cout.put('\n');
                            _0xb7d0_st = 0x0F1E2D3Cu;
                        }
                        break;
                    }
                    default: {
                        _0xb7d0_st = 0x0F1E2D3Cu;
                        break;
                    }
                }
            }
        }
    };
    
    enum class _0x0c25_op : uint8_t {
        _0x1d36_nop     = 0x12,
        _0x2e47_imm     = 0x27,
        _0x3f58_mov     = 0x3E,
        _0x4069_in      = 0x4B,
        _0x517a_out     = 0x5D,
        _0x628b_push    = 0x68,
        _0x739c_pop     = 0x79,
        _0x84ad_add     = 0x8A,
        _0x95be_sub     = 0x94,
        _0xa6cf_xor     = 0xAC,
        _0xb7d0_halt    = 0xF3
    };
    
    struct _0xc8e1_ctx {
        int64_t _0xd9f2_reg[8];
        int64_t _0xea03_stk[64];
        uint32_t _0xfb14_ip;
        uint32_t _0x0c25_sp;
        bool _0x1d36_hlt;
        uint32_t _0x2e47_flg;
    
        _0xc8e1_ctx() : _0xfb14_ip(0), _0x0c25_sp(0), _0x1d36_hlt(false), _0x2e47_flg(0) {
            for (size_t _0x3f58_i = 0; _0x3f58_i < 8; ++_0x3f58_i) {
                _0xd9f2_reg[_0x3f58_i] = 0;
            }
            for (size_t _0x4069_j = 0; _0x4069_j < 64; ++_0x4069_j) {
                _0xea03_stk[_0x4069_j] = 0;
            }
        }
    };
    
    class _0x517a_vm {
    private:
        _0xc8e1_ctx _0x628b_c;
        std::vector<uint8_t> _0x739c_rom;
        _0x7f8a::_0xc8e7 _0x84ad_cph;
    
    public:
        _0x517a_vm(const uint8_t* _0x95be_d, size_t _0xa6cf_s, uint32_t _0xb7d0_k)
            : _0x84ad_cph(_0xb7d0_k) {
            _0x739c_rom.assign(_0x95be_d, _0x95be_d + _0xa6cf_s);
        }
    
        inline uint8_t _0xc8e1_fetch() noexcept {
            if (_0x628b_c._0xfb14_ip >= _0x739c_rom.size()) {
                _0x628b_c._0x1d36_hlt = true;
                return static_cast<uint8_t>(_0x0c25_op::_0xb7d0_halt);
            }
            uint8_t _0xd9f2_cb = _0x739c_rom[_0x628b_c._0xfb14_ip];
            uint8_t _0xea03_pb = _0x84ad_cph._0x406f(_0xd9f2_cb, _0x628b_c._0xfb14_ip);
            _0x628b_c._0xfb14_ip = static_cast<uint32_t>(_0x739c::_0x0c25(_0x628b_c._0xfb14_ip, 1));
            return _0xea03_pb;
        }
    
        void _0xfb14_exec() {
            uint32_t _0x0c25_st = 0x00010001u;
    
            while (!_0x628b_c._0x1d36_hlt && _0x0c25_st != 0xEEEEFFFFu) {
                switch (_0x0c25_st) {
                    case 0x00010001u: {
                        uint8_t _0x1d36_b = _0xc8e1_fetch();
                        _0x0c25_op _0x2e47_o = static_cast<_0x0c25_op>(_0x1d36_b);
    
                        switch (_0x2e47_o) {
                            case _0x0c25_op::_0x1d36_nop: {
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0x4069_in: {
                                uint8_t _0x3f58_r = _0xc8e1_fetch() & 0x07;
                                _0x628b_c._0xd9f2_reg[_0x3f58_r] = _0x1d36_io::_0x2e47_read();
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0x517a_out: {
                                uint8_t _0x4069_r = _0xc8e1_fetch() & 0x07;
                                _0x1d36_io::_0x95be_write(_0x628b_c._0xd9f2_reg[_0x4069_r]);
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0x628b_push: {
                                uint8_t _0x517a_r = _0xc8e1_fetch() & 0x07;
                                if (_0x628b_c._0x0c25_sp < 64) {
                                    _0x628b_c._0xea03_stk[_0x628b_c._0x0c25_sp] = _0x628b_c._0xd9f2_reg[_0x517a_r];
                                    _0x628b_c._0x0c25_sp = static_cast<uint32_t>(_0x739c::_0x0c25(_0x628b_c._0x0c25_sp, 1));
                                }
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0x739c_pop: {
                                uint8_t _0x628b_r = _0xc8e1_fetch() & 0x07;
                                if (_0x628b_c._0x0c25_sp > 0) {
                                    _0x628b_c._0x0c25_sp = static_cast<uint32_t>(_0x739c::_0xa6cf_sub(_0x628b_c._0x0c25_sp, 1));
                                    _0x628b_c._0xd9f2_reg[_0x628b_r] = _0x628b_c._0xea03_stk[_0x628b_c._0x0c25_sp];
                                }
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0x84ad_add: {
                                uint8_t _0x739c_d = _0xc8e1_fetch() & 0x07;
                                uint8_t _0x84ad_s = _0xc8e1_fetch() & 0x07;
                                _0x628b_c._0xd9f2_reg[_0x739c_d] = _0x739c::_0x0c25(
                                    _0x628b_c._0xd9f2_reg[_0x739c_d],
                                    _0x628b_c._0xd9f2_reg[_0x84ad_s]
                                );
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0x95be_sub: {
                                uint8_t _0x95be_d = _0xc8e1_fetch() & 0x07;
                                uint8_t _0xa6cf_s = _0xc8e1_fetch() & 0x07;
                                _0x628b_c._0xd9f2_reg[_0x95be_d] = _0x739c::_0xa6cf_sub(
                                    _0x628b_c._0xd9f2_reg[_0x95be_d],
                                    _0x628b_c._0xd9f2_reg[_0xa6cf_s]
                                );
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0xa6cf_xor: {
                                uint8_t _0xb7d0_d = _0xc8e1_fetch() & 0x07;
                                uint8_t _0xc8e1_s = _0xc8e1_fetch() & 0x07;
                                _0x628b_c._0xd9f2_reg[_0xb7d0_d] ^= _0x628b_c._0xd9f2_reg[_0xc8e1_s];
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0x3f58_mov: {
                                uint8_t _0xd9f2_d = _0xc8e1_fetch() & 0x07;
                                uint8_t _0xea03_s = _0xc8e1_fetch() & 0x07;
                                _0x628b_c._0xd9f2_reg[_0xd9f2_d] = _0x628b_c._0xd9f2_reg[_0xea03_s];
                                _0x0c25_st = 0x00010001u;
                                break;
                            }
                            case _0x0c25_op::_0xb7d0_halt: {
                                _0x628b_c._0x1d36_hlt = true;
                                _0x0c25_st = 0xEEEEFFFFu;
                                break;
                            }
                            default: {
                                _0x0c25_st = 0xDEADBEEFu;
                                break;
                            }
                        }
    
                        if (!_0x7f8a::_0x62a3<0x77777777ULL>::_0x84c5()) {
                            _0x0c25_st = 0xDEADBEEFu;
                        }
                        break;
                    }
                    case 0xDEADBEEFu: {
                        _0x628b_c._0x1d36_hlt = true;
                        _0x0c25_st = 0xEEEEFFFFu;
                        break;
                    }
                    default: {
                        _0x0c25_st = 0xEEEEFFFFu;
                        break;
                    }
                }
            }
        }
    };
    
    static const uint8_t _0xfeed_rom[] = {
        0x88, 0xe2, 0x32, 0x72, 0x2c, 0xf4, 0x37, 0x82,
        0x6b, 0x01, 0x3f, 0xbb, 0xed, 0xa2, 0x0e, 0xf3,
        0x83, 0xd0, 0xb2
    };
    
    static constexpr size_t _0xbeef_size = sizeof(_0xfeed_rom) / sizeof(_0xfeed_rom[0]);
    static constexpr uint32_t _0xcafe_key = 0x7F4A8C1Du;
    
    int main() {
        std::ios_base::sync_with_stdio(false);
        std::cin.tie(nullptr);
        _0x517a_vm _0xface_inst(_0xfeed_rom, _0xbeef_size, _0xcafe_key);
        _0xface_inst._0xfb14_exec();
        return 0;
    }
    

    信息

    ID
    1
    时间
    1000ms
    内存
    128MiB
    难度
    1
    标签
    递交数
    5287
    已通过
    1493
    上传者