69 条题解

  • 3
    @ 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);
    }
    
    
    
    • 3
      @ 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;
        }
        
        • 1
          @ 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
              @ 2025-10-25 9:33:33
              #include<bits/stdc++.h>
              using namespace std;
              const int N=1e3+10;
              int a,b;
              int main()
              {
              	cin >> a >> b;
              	cout << a+b;
              	return 0;
              }
              
              
              • -1
                @ 2026-8-10 21:31:13

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

                • -1
                  @ 2026-7-20 19:15:41
                  #include <bits/stdc++.h>
                  using namespace std;
                  int n , a , b , c , s , j , ans;
                  int main()
                  {
                      cin >> n;
                      for ( int i = 1; i <= n; i++ )
                      {
                          cin >> a >> b >> c;
                          s = a + b + c;
                          if (j < s )
                          {
                          	ans++;
                  		}
                          j = s;   
                  	} 
                  	cout << ans - 1;
                  	return 0;
                  }
                  
                  
                  • -1
                    @ 2026-7-20 18:50:53
                    #include <bits/stdc++.h>
                    using namespace std;
                    int n , a , sum;
                    int main()
                    {
                        cin >> n;
                        for ( int i = 1; i <= n; i++ )
                        {
                            cin >> a;
                    		sum = sum + a; 
                    	}
                    	if ( sum % n < sum / n )
                    	{
                    		cout << sum / n - 1 << endl << sum % n + n;
                    	}
                    	else
                    	{
                    		cout << sum / n << endl << sum % n;
                    	}
                    	return 0;
                    }
                    
                    
                    • -1
                      @ 2026-7-20 18:31:00
                      #include <bits/stdc++.h>
                      using namespace std;
                      int n , a , s , f , j;
                      int main()
                      {
                          cin >> n;
                          for ( int i = 1; i <= n; i++ )
                          {
                          	cin >> a;//12345
                          	s = s + a / 100;
                          	f = f + a % 100 / 10 ;
                          	j = j + a % 10;
                      	}
                      	cout << s << endl << f << endl << j << endl;
                      	return 0;
                      }
                      
                      
                      • -1
                        @ 2026-7-20 18:03:23
                        #include <bits/stdc++.h>
                        using namespace std;
                        int k,sum;
                        int main()
                        {
                        	cin >> k;
                            for ( int i = 10000; i <= 30000; i++ )
                            {
                            	int sub1 = i / 100;
                            	int sub2 = i / 10 % 1000;
                            	int sub3 = i % 1000;
                            	if ( sub1 % k == 0 && sub2 % k == 0 && sub3 % k == 0 )
                            	{
                            		sum++;
                            		cout << i << endl;
                        		}
                        	}
                        	if ( sum == 0 )
                        	{
                        		cout << "No";
                        	}
                        	return 0;
                        }
                        
                        
                        • -1
                          @ 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;
                          }
                          
                          
                          • -1
                            @ 2026-6-28 11:32:18

                            #include<bits/stdc++.h> using namespace std; #define int long long const int N=1e6+5; int n,num[N],a[N],c[N],sum,ans; signed main(){ cin>>n; setst; for(int i=1;i<=n;i++){ cin>>a[i]; num[a[i]]++; st.insert(a[i]); }sum=st.size(); for(int i=n;i>=1;i--){ if(c[a[i]]&&a[i]!=a[i-1]&&i!=1){ ans+=sum-1; //cout<<i<<endl; }num[a[i]]--; if(!num[a[i]])sum--; if(!c[a[i]])c[a[i]]++; }cout<<ans; return 0; }

                            • -1
                              @ 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;
                              }
                              
                              • -1
                                @ 2026-4-15 13:26:15
                                #include<stdio.h>
                                int main(){
                                    int a,b;
                                    scanf("%d%d",&a,&b);
                                    printf("%d",a+b);
                                }
                                
                                • -1
                                  @ 2025-12-14 12:27:47
                                  #include <iostream>
                                  using namespace std;
                                  int main()
                                  {
                                  	int a,b;
                                  	cin>>a>>b;
                                  	cout<<a+b;
                                  	return 0;
                                  }
                                  
                                  • -1
                                    @ 2025-11-22 9:37:06
                                    #include<bits/stdc++.h>
                                    using namespace std;
                                    const int N=1e3+10;
                                    int Accepted(int a,int b){//Accepted()
                                    	return a+b; 
                                    }
                                    int main()
                                    {
                                    	int a,b;
                                    	cin >> a >> b;
                                    	cout << Accepted(a,b);
                                    	return 0;
                                    }
                                    //老登布置的作业系列
                                    
                                    
                                    • -1
                                      @ 2025-11-8 9:43:09
                                      #include<bits/stdc++.h>
                                      
                                      using namespace std;
                                      int main()
                                      {
                                      	string a1,b1;
                                      	int a[10000]={},b[10000]={},c[10000]={};
                                      	cin >> a1 >> b1;
                                      	int lena=a1.size();
                                      	int lenb=b1.size();
                                      	for(int i=1;i<=lena;i++)
                                      	{
                                      		a[i]=a1[lena-i]-'0';
                                      	} 
                                      	for(int i=1;i<=lenb;i++)
                                      	{
                                      		b[i]=b1[lenb-i]-'0';
                                      	}  
                                      	int lenc=1;
                                      	while(lenc<=lena||lenc<=lenb)
                                      	{
                                      		c[lenc]+=a[lenc]+b[lenc];
                                      		if(c[lenc]>9)
                                      		{
                                      			c[lenc]-=10;
                                      			c[lenc+1]++; 
                                      		}
                                      		lenc++;
                                      	} 
                                      	if(c[lenc]==0)
                                      	{
                                      		lenc--;
                                      	}
                                      	for(int i=lenc;i>=1;i--)
                                      	{
                                      		cout << c[i];
                                      	}
                                      	return 0;
                                      }
                                      
                                      • -2
                                        @ 2026-9-6 20:52:10

                                        #include<bits/stdc++.h> using namespace std; char sa[505],sb[505]; int a[505],b[505],c[505]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>sa>>sb; int la=strlen(sa),lb=strlen(sb); for(int i=0;i<la;i++)a[la-i]=sa[i]-'0'; for(int i=0;i<lb;i++)b[lb-i]=sb[i]-'0'; int lc=max(la,lb); for(int i=1;i<=lc;i++){ c[i]+=a[i]+b[i]; c[i+1]+=c[i]/10; c[i]%=10; } if(c[lc+1]>0)lc++; for(int i=lc;i>=1;i--)cout<<c[i]; return 0; }

                                        • -2
                                          @ 2026-9-6 20:52:00

                                          #include<bits/stdc++.h> using namespace std; char sa[505],sb[505]; int a[505],b[505],c[505]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>sa>>sb; int la=strlen(sa),lb=strlen(sb); for(int i=0;i<la;i++)a[la-i]=sa[i]-'0'; for(int i=0;i<lb;i++)b[lb-i]=sb[i]-'0'; int lc=max(la,lb); for(int i=1;i<=lc;i++){ c[i]+=a[i]+b[i]; c[i+1]+=c[i]/10; c[i]%=10; } if(c[lc+1]>0)lc++; for(int i=lc;i>=1;i--)cout<<c[i]; return 0; }

                                          信息

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