70 条题解

  • 2
    @ 2026-10-4 11:32:55

    新用户推荐http://temege.com/p/1/solution/66a310d55ed1c81f72f96654

    这里附一个线段树代码也可AC,推荐使用

    #include <bits/stdc++.h>
    #define int long long
    using namespace std;
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    struct node
    {
    	int l , r , num;
    }tree [N];
    int a [N] = {} , n , tag[N];
    void ctf (int c)
    {
    	tree [c].num = tree [(c << 1)].num + tree [(c << 1) + 1].num;
    }
    void buildt (int sp , int l , int r)
    {
    	tree [sp].l = l;
    	tree [sp].r = r;
    	if(l == r)
    	{
    		tree [sp].num = a [l];
    		return;
    	}
    	int mid = l + r >> 1;
    	buildt ((sp << 1) , l , mid);
    	buildt ((sp << 1) + 1 , mid + 1 , r);
    	ctf (sp);
    }
    void f (int sp)
    {
    	int mid = tree [sp].l + tree [sp].r >> 1;
    	if (tag [sp])
    	{
    		tree [(sp << 1)].num += tag [sp] * (mid - tree[sp].l + 1);
    		tree [(sp << 1) + 1].num += tag [sp] * (tree [sp].r - mid);
    		tag [(sp << 1)] += tag [sp];
    		tag [(sp << 1) + 1] += tag [sp];
    		tag [sp] = 0;
    	}
    }
    void def (int sp , int pt , int nn)
    {
    	if(tree [sp].l == tree [sp].r)
    	{
    		tree [sp].num += nn;
    		return;
    	}
    	int mid = tree [sp].l + tree [sp].r >> 1;
    	if (pt <= mid) def ((sp << 1) , pt , nn);
    	else def((sp << 1) + 1 , pt , nn);
    	ctf (sp);
    }
    void init(int sp , int l , int r , int c)
    {
    	if(tree [sp].l >= l && tree [sp].r <= r)
    	{
    		tree [sp].num += (tree [sp].r - tree [sp].l + 1) * c;
    		tag [sp] += c;
    		return;
    	}
    	f (sp);
    	int mid = tree [sp].l + tree[sp].r >> 1;
    	if (l <= mid) init((sp << 1) , l , r , c);
    	if (mid < r) init((sp << 1) + 1 , l , r , c);
    	ctf (sp);
    }
    int answ (int sp , int l , int r)
    {
    	if (tree [sp].l >= l && tree [sp].r <= r)return tree [sp].num;
    	f (sp);
    	int mid = tree [sp].l + tree [sp].r >> 1;
    	int maxn = 0;
    	if (l <= mid) maxn = maxn + answ ((sp << 1) , l , r);
    	if (mid < r) maxn = maxn + answ ((sp << 1) + 1 , l , r);
    	return maxn;
    }
    signed main()
    {
    		int T = 1;
    	    n = 2;
    		for (int i = 1; i <= n; i++) cin >> a [i];
    	    buildt (1 , 1 , 2);
    	    cout << answ (1 , 1 , 2);
    }
    
    
    
    • 2
      @ 2024-7-26 10:58:29

      A+B Problem题解

      新用户强烈建议阅读此帖

      首先我们要理清思路

      1.需要用到什么样的头文件?

      2.用什么样的数据范围?

      3.思路是什么?

      首先题目中的数据范围是1≤a,b≤10^6, 而int 的范围是-2147483648-2147483647 正合题意,所以数据类型可以用int

      话不多说,直接上代码

      #include<iostream>//导入头文件,iostream里面是标准输入输出流(我说的什么?) 
      using namespace std;//使用标准命名空间 
      int main(){//主函数,程序的入口 
      	int a,b;//创建a,b两个整型变量 
      	cin>>a>>b;//输入 a , b 两个变量 
      	cout<<a+b; //输出a+b的内容 
      	return 0; 
      }
      

      本蒟蒻发的第一篇题解,请多多支持喵~~

      • 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;
        }
        
        • @ 2026-10-25 11:23:38

          @,模拟退火+遗传算法+混沌映射+粒子群优化+蒙特卡洛代码如下:

          #pragma GCC optimize(3)
          #pragma GCC optimize("Ofast")
          #pragma GCC optimize("inline")
          #pragma GCC optimize("-fgcse")
          #pragma GCC optimize("-fgcse-lm")
          #pragma GCC optimize("-fipa-sra")
          #pragma GCC optimize("-ftree-pre")
          #pragma GCC optimize("-ftree-vrp")
          #pragma GCC optimize("-fpeephole2")
          #pragma GCC optimize("-ffast-math")
          #pragma GCC optimize("-fsched-spec")
          #pragma GCC optimize("unroll-loops")
          #pragma GCC optimize("-falign-jumps")
          #pragma GCC optimize("-falign-loops")
          #pragma GCC optimize("-falign-labels")
          #pragma GCC optimize("-fdevirtualize")
          #pragma GCC optimize("-fcaller-saves")
          #pragma GCC optimize("-fcrossjumping")
          #pragma GCC optimize("-fthread-jumps")
          #pragma GCC optimize("-funroll-loops")
          #pragma GCC optimize("-fwhole-program")
          #pragma GCC optimize("-freorder-blocks")
          #pragma GCC optimize("-fschedule-insns")
          #pragma GCC optimize("inline-functions")
          #pragma GCC optimize("-ftree-tail-merge")
          #pragma GCC optimize("-fschedule-insns2")
          #pragma GCC optimize("-fstrict-aliasing")
          #pragma GCC optimize("-fstrict-overflow")
          #pragma GCC optimize("-falign-functions")
          #pragma GCC optimize("-fcse-skip-blocks")
          #pragma GCC optimize("-fcse-follow-jumps")
          #pragma GCC optimize("-fsched-interblock")
          #pragma GCC optimize("-fpartial-inlining")
          #pragma GCC optimize("no-stack-protector")
          #pragma GCC optimize("-freorder-functions")
          #pragma GCC optimize("-findirect-inlining")
          #pragma GCC optimize("-fhoist-adjacent-loads")
          #pragma GCC optimize("-frerun-cse-after-loop")
          #pragma GCC optimize("inline-small-functions")
          #pragma GCC optimize("-finline-small-functions")
          #pragma GCC optimize("-ftree-switch-conversion")
          #pragma GCC optimize("-foptimize-sibling-calls")
          #pragma GCC optimize("-fexpensive-optimizations")
          #pragma GCC optimize("-funsafe-loop-optimizations")
          #pragma GCC optimize("inline-functions-called-once")
          #pragma GCC optimize("-fdelete-null-pointer-checks")
          
          #include<condition_variable>
          #include<initializer_list>
          #include<unordered_map>
          #include<unordered_set>
          #include<forward_list>
          #include<system_error>
          #include<type_traits>
          #include<functional>
          #include<stdexcept>
          #include<algorithm>
          #include<cinttypes>
          #include<cstdalign>
          #include<exception>
          #include<streambuf>
          #include<typeinfo>
          #include<valarray>
          #include<iterator>
          #include<iostream>
          #include<ccomplex>
          #include<cstdbool>
          #include<ciso646>
          #include<climits>
          #include<clocale>
          #include<complex>
          #include<csetjmp>
          #include<csignal>
          #include<cstdarg>
          #include<cstddef>
          #include<cstdint>
          #include<cstdlib>
          #include<cstring>
          #include<ctgmath>
          #include<cwctype>
          #include<fstream>
          #include<iomanip>
          #include<istream>
          #include<numeric>
          #include<ostream>
          #include<sstream>
          #include<utility>
          #include<cassert>
          #include<cfloat>
          #include<chrono>
          #include<cstdio>
          #include<cwchar>
          #include<cerrno>
          #include<future>
          #include<limits>
          #include<locale>
          #include<memory>
          #include<random>
          #include<string>
          #include<bitset>
          #include<thread>
          #include<vector>
          #include<atomic>
          #include<cfenv>
          #include<cmath>
          #include<ctime>
          #include<deque>
          #include<mutex>
          #include<queue>
          #include<ratio>
          #include<regex>
          #include<stack>
          #include<tuple>
          #include<array>
          using namespace std;
          #define ll long long
          #define ull unsigned long long
          #define ld long double
          #define ui unsigned long long
          #define se second
          #define fi first
          const int N = 50;
          const int M = 300;
          int add(int a,int b) {
          	random_device rd;
          	mt19937 gen(rd());
          	uniform_int_distribution <int> dist(-100000,100000);
          	int tat = a + b;
          	int cet = dist(gen);
          	int best = cet;
          	double temt = 1000.0;
          	for (int j = 0;j < 50000;++j) {
          		uniform_int_distribution <int> delta(-10,10);
          		int neb = cet + delta(gen);
          		int c1 = abs(cet - tat);
          		int c2 = abs(neb - tat);
          		if (c2 < c1) {
          			cet = neb;
          		}
          		else {
          			double prob = exp((c1 - c2) / temt);
          			uniform_real_distribution <double> pd(0.0,1.0);
          			if (pd(gen) < prob) {
          				cet = neb;
          			}
          		}
          		if (abs(cet - tat) < abs(best - tat)) {
          			best = cet;
          		}
          		temt *= 0.999;
          		if (best == tat) {
          			break;
          		}
          	}
          	return best;
          }
          int gtc(int a,int b) {
          	random_device rd;
          	mt19937 gen(rd());
          	int tat = a + b;
          	const int PS = 200;
          	const int GT = 500;
          	vector<int> pp(PS);
          	uniform_int_distribution<int> i1(-100000,100000);
          	for (int i = 0;i < PS;++i) {
          		pp[i] = i1(gen);
          	}
          	for (int j = 0;j < GT;++j) {
          		vector <pair <int,int> > fns;
          		for (int i = 0;i < PS;++i) {
          			int dist = abs(pp[i] - tat);
          			fns.push_back(make_pair(dist,pp[i]));
          		}
          		sort(fns.begin(),fns.end());
          		if (fns[0].fi == 0) {
          			return fns[0].se;
          		}
          		int ez = PS / 3;
          		vector <int> npp;
          		for (int i = 0;i < ez;++i) {
          			npp.push_back(fns[i].se);
          		}
          		uniform_int_distribution <int> m1(0,ez - 1);
          		uniform_int_distribution <int> m2(-5,5);
          		while (static_cast<int>(npp.size()) < PS) {
          			int p1 = npp[m1(gen)];
          			int p2 = npp[m1(gen)];
          			int child = (p1 + p2) / 2 + m2(gen);
          			npp.push_back(child);
          		}
          		pp = npp;
          	}
          	return pp[0];
          }
          int mcl(int a,int b) {
          	random_device rd;
          	mt19937 gen(rd());
          	int tat = a + b;
          	int best = 0;
          	int bd = abs(0 - tat);
          	uniform_int_distribution <int> dist(-200000,200000);
          	for (int i = 0;i < 200000;++i) {
          		int cad = dist(gen);
          		int d = abs(cad - tat);
          		if (d < bd) {
          			bd = d;
          			best = cad;
          		}
          		if (bd == 0) {
          			break;
          		}
          	}
          	return best;
          }
          int psd(int a,int b) {
          	random_device rd;
          	mt19937 gen(rd());
          	int tat = a + b;
          	vector <double> p1(N);
          	vector <double> p2(N);
          	vector <double> p3(N);
          	vector <double> p4(N);
          	double g1 = 0,g2 = 1e9;
          	uniform_real_distribution <double> i1(-100000.0,100000.0);
          	uniform_real_distribution <double> i2(-1000.0,1000.0);
          	uniform_real_distribution <double> i3(0.0,1.0);
          	for (int i = 0;i < N;++i) {
          		p1[i] = i1(gen);
          		p2[i] = i2(gen);
          		p3[i] = p1[i];
          		p4[i] = abs(p1[i] - tat);
          		if (p4[i] < g2) {
          			g2 = p4[i];
          			g1 = p1[i];
          		}
          	}
          	double w = 0.7,c1 = 1.5,c2 = 1.5;
          	for (int j = 0;j < M;++j) {
          		for (int i = 0;i < N;++i) {
          			double r1 = i3(gen),r2 = i3(gen);
          			p2[i] = w * p2[i] + c1 * r1 * (p3[i] - p1[i]) + c2 * r2 * (g1 - p1[i]);
          			p1[i] += p2[i];
          			double ss = abs(p1[i] - tat);
          			if (ss < p4[i]) {
          				p4[i] = ss;
          				p3[i] = p1[i];
          				if (ss < g2) {
          					g2 = ss;
          					g1 = p1[i];
          				}
          			}
          		}
          		if (g2 < 0.5) {
          			break;
          		}
          	}
          	return static_cast <int> (g1);
          }
          int chao(int a,int b) {
          	int tat = a + b;
          	double x = 0.314159;
          	double r = 3.99;
          	int best = 0;
          	int bd = abs(0 - tat);
          	for (int i = 0;i < 100000;++i) {
          		x = r * x * (1.0 - x);
          		int cad = static_cast <int> ((x * 300000.0) - 150000.0);
          		int d = abs(cad - tat);
          		if (d < bd) {
          			bd = d;
          			best = cad;
          		}
          		if (bd == 0) {
          			break;
          		}
          	}
          	return best;
          }
          int solve(int a,int b) {
          	vector <int> res;
          	res.push_back(add(a,b));
          	res.push_back(gtc(a,b));
          	res.push_back(mcl(a,b));
          	res.push_back(psd(a,b));
          	res.push_back(chao(a,b));
          	int tat = a + b;
          	vector <pair <int,int> > weid;
          	for (vector <int>::const_iterator it = res.begin();it != res.end();++it) {
          		int dist = abs(*it - tat);
          		weid.push_back(make_pair(dist,*it));
          	}
          	sort(weid.begin(),weid.end());
          	int sum = 0,cnt = 0;
          	for (int i = 0;i < 3 && i < static_cast <int> (weid.size());++i) {
          		sum += weid[i].se;
          		cnt++;
          	}
          	int ans = (cnt > 0) ? static_cast <int> (sum / cnt) : (a + b);
          	if (ans != a + b) {
          		ans = a + b;
          	}
          	return ans;
          }
          int main() {
          	int a,b;
          	cin >> a >> b;
          	cout << solve(a,b) << endl; 
          	return 0;
          }
          

          明显没你的复杂

      • 0
        @ 2026-10-29 20:37:37

        录制:BrAve。的快速会议 日期:2026-10-25 16:00:19 录制文件:https://meeting.tencent.com/crm/2y3omMPo8f

        • 0
          @ 2026-10-17 15:31:08

          #include <bits/stdc++.h> using namespace std;

          int main() { //int a, b; //cin >>> a >> b; //cout << a + b << endl; //return 0; }

          • 0
            @ 2026-7-23 9:04:04
            #include<bits/stdc++.h>
            using namespace std;
            
            int main(){
            	int a,b;
            	cin>>a>>b;
            	cout<<a+b; 
            	return 0;
            }
            //入门题解包AC!!!
            
            • 0
              @ 2026-7-20 19:30:49
              #include <bits/stdc++.h>
              using namespace std;
              int n , a , g , s , b , ans;
              int main()
              {
                  cin >> n;
                  for ( int i = 1; i <= n; i++ )
                  {
                  	cin >> a;
                  	b = a / 100;
                  	s = a % 100 / 10;
                  	g = a % 10;
                  	if( b == s && b == g)
                  	{
              //    		break;
                  		continue;
              		}
                  	
                  	if ( b == s || b == g || s == g )
                  	{
                  		ans++;
              		}
              	}
              	cout << ans;
              	return 0;
              }
              
              
              • 0
                @ 2026-2-2 12:29:27
                #include<bits/stdc++.h>
                using namespace std;
                
                const int N=1e5+5;
                
                int n , m , a[N];
                int u , v;
                vector<int> vc[N];
                int dfn[N] , low[N] , cnt;
                bool vis[N];
                stack<int> st;
                int belong_cnt; //强连通分量个数 
                vector<int> belong[N];//强连通分量 
                int color[N];//color[i]表示第i头牛所处的强连通分量  
                vector<int> newvc[N];
                int in[N];//入度 
                int ans[N];
                void tarjan(int u)
                {
                	dfn[u] = low[u] = ++cnt;
                	vis[u] = 1;
                	st.push(u);
                	for(int i = 0; i < vc[u].size(); i++)
                	{
                		int v = vc[u][i];
                		if(!dfn[v])
                		{
                			tarjan(v);
                			low[u] = min(low[u] , low[v]);
                		}
                		else if(vis[v])
                		{
                			low[u] = min(low[u] , low[v]);
                		}	
                	}
                	//强连通分量到头	
                	if(dfn[u] == low[u])
                	{
                		while(!st.empty())
                		{
                			v = st.top();
                			st.pop();
                			vis[v] = 0;
                			color[v] = u;//当前牛所处的强连通分量 
                			if(u == v) break;
                			a[u] += a[v];
                		}
                	}
                }
                
                void tupo()
                {
                	queue<int> q;
                	for(int i = 1; i <= n; i++)
                	{
                		if(color[i] == i && !in[i])
                		{
                			q.push(i);
                			ans[i] = a[i];
                		}
                	}
                	
                	while(!q.empty())
                	{
                		int top = q.front();
                		q.pop();
                		
                		for(int i = 0; i < newvc[top].size(); i++)
                		{
                			v = newvc[top][i];
                			ans[v] = max(ans[v] , ans[top] + a[v]);
                			in[v]--;
                			if(!in[v])
                				q.push(v);
                		}
                	}
                	
                	int maxx = 0;
                	for(int i = 1; i <= n; i++)
                		maxx = max(maxx , ans[i]);
                	cout << maxx;
                }
                
                int main(){
                	cin >> n >> m;
                	for(int i = 1; i <= n; i++)
                		cin >> a[i];
                	while( m-- )
                	{
                		cin >> u >> v;
                		vc[u].push_back(v); 
                	}
                	for(int i = 1; i <= n; i++)
                		if(!dfn[i])
                			tarjan(i);
                	
                	//重新建边
                	for(int i = 1; i <= n; i++)
                	{
                		for(int j = 0; j < vc[i].size(); j++)
                		{
                			v = vc[i][j];
                			if(color[i] != color[v])
                			{
                				newvc[color[i]].push_back(color[v]);
                				in[color[v]]++; 
                			}	
                		}	
                	} 
                	
                	tupo();
                	
                	return 0;
                
                • -2
                  @ 2026-7-20 17:29:24
                  #include <bits/stdc++.h>
                  using namespace std;
                  int n;
                  int main()
                  {
                      cin >> n;
                  	for ( int i = 1; i <= n; i++ )
                  	{
                  		if ( i % 10 == 8 )
                  		{
                  			cout << i << " "  << 2 * i << " " << 4 * i << endl;
                  		}		
                  	}
                  	return 0;
                  }
                  
                  
                  • -2
                    @ 2026-6-24 11:55:14
                    #include<bits/stdc++.h>
                    using namespace std;
                    int main(){//头文件
                    	int a,b;//创建变量
                    	cin>>a>>b;//输入
                    	cout<<a+b;//输出
                    	return 0;
                    }
                    
                    • -2
                      @ 2026-5-29 13:50:47
                      var a, b: longint;
                      begin
                          readln(a,b);
                          writeln(a+b);
                      end.
                      
                      
                      • -2
                        @ 2026-5-29 13:48:27
                        import java.io.*;
                        import java.util.*;
                        public class Main {
                            public static void main(String args[]) throws Exception {
                                Scanner cin=new Scanner(System.in);
                                int a = cin.nextInt(), b = cin.nextInt();
                                System.out.println(a+b);
                            }
                        }
                        
                        
                        • -2
                          @ 2026-5-15 17:25:00

                          #include <bits/stdc++.h> using namespace std; int main(){ int a; int b; cin>>a>>b; cout<<a+b; return 0; }

                          • -2
                            @ 2026-4-15 13:26:15
                            #include<stdio.h>
                            int main(){
                                int a,b;
                                scanf("%d%d",&a,&b);
                                printf("%d",a+b);
                            }
                            
                            • -2
                              @ 2026-4-15 13:23:53

                              python代码

                              
                              a=int(input())
                              b=int(input())
                              print(a+b)
                              
                              • -2
                                @ 2026-3-29 19:04:19

                                #include <bits/stdc++.h> using namespace std; int main(){ int a,b,s; cin>>a>>b; s=a+b; cout<<s; return 0; }

                                • -2
                                  @ 2026-3-27 15:15:43
                                  #include <bits/stdc++.h>
                                  using namespace std;
                                  
                                  int main(){
                                      int a, b;
                                      cin >> a >> b;
                                      cout << a + b << endl;
                                      return 0;
                                  }
                                  
                                  • -2
                                    @ 2026-3-22 17:42:07
                                    #include <bits/stdc++.h>
                                    using namespace std;
                                    int main(){
                                      int a,b,s;
                                      cin>>a>>b;
                                      s=a+b;
                                      cout<<s;
                                      return 0;
                                    }
                                    
                                    • -2
                                      @ 2026-3-16 21:13:55

                                      #include <bits/stdc++.h> using namespace std;

                                      int main(){ int a,b; cin>>a>>b; cout<<a+b; return 0; }

                                      • -2
                                        @ 2025-12-14 12:27:47
                                        #include <iostream>
                                        using namespace std;
                                        int main()
                                        {
                                        	int a,b;
                                        	cin>>a>>b;
                                        	cout<<a+b;
                                        	return 0;
                                        }
                                        

                                        信息

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