70 条题解

  • 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);
    }
    
    
    
    • 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-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-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-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;
            }
            
            • 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;
              
              • -1
                @ 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;
                }
                
                
                • -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-6-5 20:32:18

                    //这是游戏 #include #include <windows.h> #include <conio.h> #include #include using namespace std;

                    const int WIDTH = 40; const int HEIGHT = 20;

                    // 蛇身体(最多100节) int snakeX[100]; int snakeY[100]; int len = 3; // 初始长度 int dir = 77; // 初始方向:右

                    int coinX, coinY; int score = 0; bool exitGame = false;

                    // 隐藏光标 void HideCursor() { HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); CONSOLE_CURSOR_INFO ci = {1, FALSE}; SetConsoleCursorInfo(h, &ci); }

                    // 定位光标 void GotoXY(int x, int y) { COORD pos = {(SHORT)x, (SHORT)y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); }

                    // 设置颜色:红色蛇,黄色金币 void SetColor(int color) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color); }

                    // 生成金币 void NewCoin() { coinX = rand() % (WIDTH - 2) + 1; coinY = rand() % (HEIGHT - 2) + 1; }

                    // 初始化蛇 void InitSnake() { len = 3; snakeX[0] = WIDTH / 2; snakeY[0] = HEIGHT / 2; snakeX[1] = snakeX[0] - 1; snakeY[1] = snakeY[0]; snakeX[2] = snakeX[0] - 2; snakeY[2] = snakeY[0]; }

                    // 绘制整个画面 void Draw() { GotoXY(0, 0);

                    // 上边框
                    for (int i = 0; i < WIDTH; i++) cout << "-";
                    cout << endl;
                    
                    for (int y = 1; y < HEIGHT; y++) {
                        cout << "|";
                        for (int x = 1; x < WIDTH - 1; x++) {
                    
                            bool isSnake = false;
                            // 画蛇头
                            if (x == snakeX[0] && y == snakeY[0]) {
                                SetColor(12); // 亮红
                                cout << "O";
                                isSnake = true;
                            }
                            // 画蛇身
                            for (int i = 1; i < len; i++) {
                                if (x == snakeX[i] && y == snakeY[i]) {
                                    SetColor(10); // 绿色
                                    cout << "o";
                                    isSnake = true;
                                }
                            }
                            // 画金币
                            if (x == coinX && y == coinY) {
                                SetColor(14); // 黄色
                                cout << "$";
                                isSnake = true;
                            }
                            // 空白
                            if (!isSnake) {
                                SetColor(7); // 白色
                                cout << " ";
                            }
                        }
                        SetColor(7);
                        cout << "|\n";
                    }
                    
                    // 下边框
                    for (int i = 0; i < WIDTH; i++) cout << "-";
                    cout << "\n得分:" << score << "    ↑↓←→移动  ESC退出";
                    

                    }

                    // 按键控制方向 void KeyControl() { if (_kbhit()) { int key = _getch(); if (key == 27) exitGame = true;

                        if (key == 224) {
                            key = _getch();
                            // 防止180度掉头
                            if (!((key == 72 && dir == 80) || (key == 80 && dir == 72) ||
                                  (key == 75 && dir == 77) || (key == 77 && dir == 75))) {
                                dir = key;
                            }
                        }
                    }
                    

                    }

                    // 蛇移动 void MoveSnake() { // 身体跟着头走 for (int i = len - 1; i > 0; i--) { snakeX[i] = snakeX[i - 1]; snakeY[i] = snakeY[i - 1]; }

                    // 移动头
                    switch (dir) {
                        case 72: snakeY[0]--; break; // 上
                        case 80: snakeY[0]++; break; // 下
                        case 75: snakeX[0]--; break; // 左
                        case 77: snakeX[0]++; break; // 右
                    }
                    
                    // 撞墙死亡
                    if (snakeX[0] <= 0 || snakeX[0] >= WIDTH - 1 || snakeY[0] <= 0 || snakeY[0] >= HEIGHT - 1)
                        exitGame = true;
                    

                    }

                    // 吃金币 + 变长 void EatCoin() { if (snakeX[0] == coinX && snakeY[0] == coinY) { score += 10; len++; // 身体变长 NewCoin(); // 新金币 } }

                    int main() { HideCursor(); srand((unsigned)time(NULL)); InitSnake(); NewCoin();

                    while (!exitGame) {
                        Draw();
                        KeyControl();
                        MoveSnake();
                        EatCoin();
                        Sleep(120); // 速度
                    }
                    
                    system("cls");
                    cout << "游戏结束!最终得分:" << score << endl;
                    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;
                                        }
                                        
                                        • -2
                                          @ 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;
                                          }
                                          //老登布置的作业系列
                                          
                                          

                                          信息

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