44 条题解

  • 26
    @ 2025-8-4 16:37:22

    这题非常难,其他的两篇题解使用了cout或者printf的高级算法,这里介绍一个基础的做法——手搓 64 位 0.5MB 内存的机器码虚拟机。

    这是虚拟机框架:

    #include<bits/stdc++.h>
    using namespace std;
    #define int long long
    #define ull unsigned int
    #define N 65536
    int memory[N];
    ull code[N] = {
    
    };
    /*
    0 Input
    1 Output
    2 Write
    3 Copy
    4 Calculate (& | ~ ^ << >>)
    5 Calculate (+ - * / %)
    6 Goto
    7 If-goto
    8 x++
    9 x--
    f Exit
    */
    signed main()
    {
    	for(int i=0;;i=(i+1)%N)
    	{
    		int op=code[i]>>60;
    		if(op==0)		//Input
    		{
    			int p=code[i]&65535;
    			cin >> memory[ (code[i]>>56)&1 ? memory[p] : p ];
    		}
    		else if(op==1)	//Output
    		{
    			int p=code[i]&65535, val = memory[ (code[i]>>56)&1 ? memory[p] : p ];
    			if((code[i]>>57)&1)
    			{
    				cout<<char(val&127);
    			}
    			else
    			{
    				cout<<val;
    			}
    		}
    		else if(op==2)	//Write
    		{
    			int p = (code[i]>>32)&65535, val = code[i]&((1ll<<32)-1);
    			memory[ (code[i]>>56)&1 ? memory[p] : p ] = val;
    		}
    		else if(op==3)	//Copy
    		{
    			int pf = (code[i]>>16)&65535, pt = code[i]&65535;
    			int val = memory[ (code[i]>>55)&1 ? memory[pf] : pf ];
    			memory[ (code[i]>>56)&1 ? memory[pt] : pt ] = val;
    		}
    		else if(op==4)	//Calculate (& | ~ ^ << >>)
    		{
    			int p1 = (code[i]>>32)&65535, p2 = (code[i]>>16)&65535, p3 = code[i]&65535;
    			int val1 = memory[ (code[i]>>58)&1 ? memory[p1] : p1 ],
    			val2 = memory[ (code[i]>>57)&1 ? memory[p2] : p2 ], val3;
    			int op2 = (code[i]>>52)&15;
    			if(op2==0)
    			{
    				val3=val1&val2;
    			}
    			else if(op2==1)
    			{
    				val3=val1|val2;
    			}
    			else if(op2==2)
    			{
    				val3=~val2;
    			}
    			else if(op2==3)
    			{
    				val3=val1^val2;
    			}
    			else if(op2==4)
    			{
    				val3=((val2>>6)?0:val1<<val2);
    			}
    			else
    			{
    				val3=((val2>>6)?0:val1>>val2);
    			}
    			memory[ (code[i]>>56)&1 ? memory[p3] : p3 ] = val3;
    		}
    		else if(op==5)	//Calculate (+ - * / %)
    		{
    			//想要乘方的建议自己写一个快速幂, 应该是能写的 
    			int p1 = (code[i]>>32)&65535, p2 = (code[i]>>16)&65535, p3 = code[i]&65535;
    			int val1 = memory[ (code[i]>>58)&1 ? memory[p1] : p1 ],
    			val2 = memory[ (code[i]>>57)&1 ? memory[p2] : p2 ], val3;
    			int op2 = (code[i]>>52)&15;
    			if(op2==0)
    			{
    				val3=val1+val2;
    			}
    			else if(op2==1)
    			{
    				val3=val1-val2;
    			}
    			else if(op2==2)
    			{
    				val3=val1*val2;
    			}
    			else if(op2==3)
    			{
    				val3=(val2?val1/val2:0);
    			}
    			else
    			{
    				val3=(val2?val1%val2:0);
    			}
    			memory[ (code[i]>>56)&1 ? memory[p3] : p3 ] = val3;
    		}
    		else if(op==6)	//Goto
    		{
    			int p=code[i]&65535;
    			i = (code[i]>>56)&1 ? memory[p] : p;
    			i = (i+N-1)%N;
    		}
    		else if(op==7)	//If-goto (> < == >= <= !=)
    		{
    			int p1 = (code[i]>>32)&65535, p2 = (code[i]>>16)&65535, p3 = code[i]&65535;
    			int val1 = memory[ (code[i]>>58)&1 ? memory[p1] : p1 ],
    			val2 = memory[ (code[i]>>57)&1 ? memory[p2] : p2 ];
    			int op2 = (code[i]>>52)&15;
    			bool flag;
    			if(op2==0)
    			{
    				flag=(val1>val2);
    			}
    			else if(op2==1)
    			{
    				flag=(val1<val2);
    			}
    			else if(op2==2)
    			{
    				flag=(val1==val2);
    			}
    			else if(op2==3)
    			{
    				flag=(val1>=val2);
    			}
    			else if(op2==4)
    			{
    				flag=(val1<=val2);
    			}
    			else
    			{
    				flag=(val1!=val2);
    			}
    			if(flag)
    			{
    				i = (code[i]>>56)&1 ? memory[p3] : p3;
    				i = (i+N-1)%N;
    			}
    		}
    		else if(op==8)	//x++
    		{
    			int p=code[i]&65535;
    			memory[ (code[i]>>56)&1 ? memory[p] : p ]++;
    		}
    		else if(op==9)	//x--
    		{
    			int p=code[i]&65535;
    			memory[ (code[i]>>56)&1 ? memory[p] : p ]--;
    		}
    		else if(op==15)	//Exit
    		{
    			break;
    		}
    		else
    		{
    			cout<<"\n\nError: Invalid code\n\n";
    		}
    	}
    	return 0;
    }
    

    这是这题的实现:

    // 将其复制进代码的第 8 行即可
    0x2000000000000048, 0x1200000000000000,	//H
    0x2000000000000065, 0x1200000000000000,	//e
    0x200000000000006c, 0x1200000000000000,	//l
    0x200000000000006c, 0x1200000000000000,	//l
    0x200000000000006f, 0x1200000000000000,	//o
    0x200000000000002c, 0x1200000000000000,	//,
    0x2000000000000057, 0x1200000000000000,	//W
    0x200000000000006f, 0x1200000000000000,	//o
    0x2000000000000072, 0x1200000000000000,	//r
    0x200000000000006c, 0x1200000000000000,	//l
    0x2000000000000064, 0x1200000000000000,	//d
    0x2000000000000021, 0x1200000000000000,	//!
    0x200000000000000a, 0x1200000000000000,	//[\n]
    0xf000000000000000	//exit
    

    拓展阅读:

    将 code 数组设为 0x0000000000000000, 0x0000000000000001, 0x5000000000010002, 0x1000000000000002, 0xf000000000000000 即可达到 A+B Problem 的要求。逐行解析:

        0x0000000000000000:输入一个整数,将其存放于内存的 0 号位置;
        0x0000000000000001:输入一个整数,将其存放于内存的 1 号位置;
        0x5000000000010002:将内存的 0,1 号位置的数相加,并将结果存放在内存的 2 号位置;
        0x1000000000000002:将 2 号位置的数以数字形式输出;
        0xf000000000000000:退出程序。
    

    AC记录

    • @ 2025-8-4 23:09:09

      @ 要把下面的代码复制到第8行。

    • @ 2026-2-28 16:53:39

      有使用说明吗,要炸了

      (ToT)

    • @ 2026-8-21 16:38:03

  • 1
    @ 2026-9-12 17:01:13

    • 1
      @ 2026-8-29 11:35:16
      #include <iostream>
      #include <string>
      #include <vector>
      #include <list>
      #include <queue>
      #include <deque>
      #include <map>
      #include <any>
      #include <algorithm>
      #include <cmath>
      
      #define sdt std
      #define usins using
      #define namepa namespace
      usins namepa sdt;
      
      #ifndef _GLIBCXX_NO_ASSERT
      #include <cassert>
      #endif
      
      #include <algorithm>
      #include <bitset>
      #include <complex>
      #include <deque>
      #include <exception>
      #include <fstream>
      #include <functional>
      #include <iomanip>
      #include <ios>
      #include <iosfwd>
      #include <iostream>
      #include <istream>
      #include <iterator>
      #include <limits>
      #include <list>
      #include <locale>
      #include <map>
      #include <memory>
      #include <new>
      #include <numeric>
      #include <ostream>
      #include <queue>
      #include <set>
      #include <sstream>
      #include <stack>
      #include <stdexcept>
      #include <streambuf>
      #include <string>
      #include <typeinfo>
      #include <utility>
      #include <valarray>
      #include <vector>
      
      #include <cctype>
      #include <cerrno>
      #include <cfloat>
      #include <ciso646>
      #include <climits>
      #include <clocale>
      #include <csetjmp>
      #include <csignal>
      #include <cstdarg>
      #include <cstddef>
      #include <cstdio>
      #include <cstdlib>
      #include <cstring>
      #include <ctime>
      #include <cwchar>
      #include <cwctype>
      
      #if __cplusplus >= 201103L
      #include <ccomplex>
      #include <cfenv>
      #include <cinttypes>
      #include <cstdalign>
      #include <cstdbool>
      #include <cstdint>
      #include <ctgmath>
      #include <cuchar>
      #endif
      
      #include <filesystem>
      #include <optional>
      #include <string_view>
      #include <variant>
      
      #include <algorithm>
      #include <bitset>
      #include <memory_resource>
      #include <bit>
      #include <complex>
      #include <exception>
      #include <fstream>
      #include <functional>
      #include <iomanip>
      #include <iosfwd>
      #include <iostream>
      #include <istream>
      #include <iterator>
      #include <limits>
      #include <locale>
      #include <memory>
      #include <new>
      #include <numeric>
      #include <ostream>
      #include <set>
      #include <sstream>
      #include <stack>
      #include <stdexcept>
      #include <streambuf>
      #include <typeinfo>
      #include <utility>
      #include <valarray>
      
      #if __cplusplus >= 201103L
      #include <array>
      #include <atomic>
      #include <chrono>
      #include <codecvt>
      #include <condition_variable>
      #include <forward_list>
      #include <future>
      #include <initializer_list>
      #include <mutex>
      #include <random>
      #include <ratio>
      #include <regex>
      #include <scoped_allocator>
      #include <system_error>
      #include <thread>
      #include <tuple>
      #include <typeindex>
      #include <type_traits>
      #include <unordered_map>
      #include <unordered_set>
      #endif
      
      #define itn int
      #define con const
      #define double long double
      #define booloo bool
      #define outc cout
      #define iff if
      #define els else
      #define tr true
      #define fal false
      #define retrn return 
      #define INTMAX 0;
      #define florr for
      #define 整型 int
      
      #define HELLOWORLD "Hello,World!"
      #define lend endl
      #define mian main
      #define stu struct
      
      stu node {
        itn l,r,a,s,d,f,g,h,j,k,q,w,e,t,y,u,i,o,p,z,x,c,v,b,n,m;
      }WW[9999];
      
      con itn A = 65;
      con itn B = 66;
      con itn C = 67;
      con itn D = 68;
      con itn E = 69;
      con itn F = 70;
      con itn G = 71;
      con itn H = 72;
      con itn I = 73;
      con itn J = 74;
      con itn K = 75;
      con itn L = 76;
      con itn M = 77;
      con itn N = 78;
      con itn O = 79;
      con itn P = 80;
      con itn Q = 81;
      con itn R = 82;
      con itn S = 83;
      con itn T = 84;
      con itn U = 85;
      con itn V = 86;
      con itn W = 87;
      con itn X = 88;
      con itn Y = 89;
      con itn Z = 90;
      
      booloo check(booloo l1,booloo l2){
      	retrn l1 == l2;
      }
      
      整型 a = 1;
      
      itn mian() {
      	iff(check(tr,tr)||check(tr,check(fal,tr))){
      		整型 n=1;
      		florr(itn i = 1;i<=n;i++){
      			florr(itn j = 1;j<=n;j++){
      				florr(itn k = 1;k<=n;k++){
      					florr(itn x = 1;x<=n;x++){
      						iff(1^0^0^1^1^1)
      							sdt::outc << HELLOWORLD << lend;
      						els
      							sdt::outc << HELLOWORLD << lend;
      						
      						//这题怎么这么难?!
      					}
      				}
      			}
      		}
      	}
      
      	retrn INTMAX
      }
      
    • 1
      @ 2026-8-14 15:26:38

      中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!中国人能飞!****

    • 1
      @ 2026-8-11 9:44:41

      • 1
        @ 2026-8-11 9:44:24

        • 1
          @ 2026-8-11 9:43:59
                            
                                                          顶顶顶顶顶顶顶顶顶        
                                              顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶        
                                          顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶           
                                顶顶顶顶  顶顶顶顶顶顶顶顶顶顶顶                    
                          顶顶顶顶顶顶顶  顶顶顶    顶顶顶顶顶                      
                顶顶顶顶顶顶顶顶顶顶顶顶            顶顶顶顶                        
            顶顶顶顶顶顶顶顶顶顶顶顶顶顶            顶顶顶顶                        
            顶顶顶顶顶顶顶顶顶顶顶顶              顶顶顶顶顶顶顶顶顶顶顶            
            顶顶顶顶顶顶顶顶顶顶顶顶            顶顶顶顶顶顶顶顶顶顶顶顶顶顶     
              顶顶顶顶顶顶顶顶顶顶          顶顶顶顶顶顶      顶顶顶顶顶顶顶        
                          顶顶顶顶          顶顶顶顶            顶顶顶顶顶          
                          顶顶顶顶        顶顶顶顶    顶顶      顶顶顶顶顶          
                          顶顶顶顶        顶顶顶顶    顶顶顶顶  顶顶顶顶顶          
                          顶顶顶顶        顶顶顶顶    顶顶顶顶  顶顶顶顶顶          
                          顶顶顶顶        顶顶顶顶    顶顶顶    顶顶顶顶顶          
                          顶顶顶顶        顶顶顶顶    顶顶顶    顶顶顶顶顶  
                          顶顶顶顶        顶顶顶顶  顶顶顶顶    顶顶顶顶顶        
                          顶顶顶顶        顶顶顶顶  顶顶顶顶    顶顶顶顶顶       
                          顶顶顶顶        顶顶顶顶  顶顶顶顶    顶顶顶顶顶       
                          顶顶顶顶        顶顶顶顶  顶顶顶顶    顶顶顶顶顶          
                          顶顶顶顶        顶顶顶    顶顶顶顶    顶顶顶顶顶    
              顶顶      顶顶顶顶顶        顶顶顶    顶顶顶      顶顶顶顶顶         
              顶顶顶顶顶顶顶顶顶顶          顶顶    顶顶        顶顶顶顶顶          
                顶顶顶顶顶顶顶顶顶                顶顶顶        顶顶顶顶            
                    顶顶顶顶顶顶顶                顶顶顶  顶顶顶顶                  
                      顶顶顶顶顶顶              顶顶顶顶    顶顶顶顶                
                            顶顶顶            顶顶顶顶顶      顶顶顶顶顶顶顶        
                                          顶顶顶顶顶顶          顶顶顶顶顶顶        
                                        顶顶顶顶顶顶            顶顶顶顶顶顶顶      
                                      顶顶顶顶顶                  顶顶顶顶顶顶   
                                    顶顶顶顶顶                      顶顶顶顶        
                                  顶顶顶                              顶顶顶
          
          
          
          
          
          
          
          • 1
            @ 2026-8-10 11:00:08

            • 1
              @ 2026-8-10 10:57:14

              I like 67 I like 67 I like 67 I like 67 I like 67 I like 67 I like 67 I like 67 I like 67 I like 67 I like 67 I like 67 I like 67

              • 0
                @ 2026-8-20 16:02:26

                • 0
                  @ 2026-8-19 14:30:44

                  不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一不要三个一

                  • 0
                    @ 2026-8-19 14:28:27

                    #P1. 【例2.1】Hello World ID: 115 远端评测题 1000ms 32MiB 尝试: 2038 已通过: 502 难度: 7 上传者:

                    root 标签> 说明 输出著名短句"hello world"。

                    输入格式 无

                    输出格式 输出"hello world"。

                    样例 输入数据 1 无 输出数据 1 hello world 进入在线编程模式 (Alt+E) 递交 题解 (91) 文件 统计 复制 相关 在以下作业中:

                    2025年夏令营新人班【查】1

                    版纳哨多哩、猫多哩的练习

                    【A班】冲刺S 300+ 图论

                    小“蒙新”的家庭作业12.28-1.3

                    • 0
                      @ 2026-8-19 14:22:11

                      牛角洲行动

                      • 0
                        @ 2026-8-18 10:11:19

                        玩三角洲的看过来,我发现了一把非常好玩的枪:AK-12,这把枪非常有性价比,好压,伤害可以,改装便宜,裸枪也便宜,快去试试吧。

                      • 0
                        @ 2026-8-14 13:58:30

                        生命畏惧时间,时间畏惧野生狗奶。

                      • 0
                        @ 2026-8-14 11:15:53

                        • 0
                          @ 2026-8-14 11:15:46

                          • 0
                            @ 2026-8-14 11:15:41

                            • 0
                              @ 2026-8-13 15:18:27

                              0 Compile Error /tmp/compiler_a_oz9k0e/src: 在成员函数‘bool node::operator<(node) const’中: /tmp/compiler_a_oz9k0e/src:9:19: 错误:‘s’在此作用域中尚未声明 9 | if(sum != s.sum) | ^ /tmp/compiler_a_oz9k0e/src: 在函数‘int main()’中: /tmp/compiler_a_oz9k0e/src:19:58: 错误:no match for ‘operator>>’ (operand types are ‘std::basic_istream::__istream_type’ {aka ‘std::basic_istream’} and ‘node’) 19 | cin>>a[i].name>>a[i].ch>>a[i].ma>>a[i].en>>a[i]; | ~~~^~ | | | | | node | std::basic_istream::__istream_type {aka std::basic_istream} In file included from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/iostream:40, from /tmp/compiler_a_oz9k0e/src:1: /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:120:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& ()(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 120 | operator>>(__istream_type& (__pf)(__istream_type&)) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:120:36: 附注: no known conversion for argument 1 from ‘node’ to ‘std::basic_istream::__istream_type& ()(std::basic_istream::__istream_type&)’ {aka ‘std::basic_istream& ()(std::basic_istream&)’} 120 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:124:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& ()(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios]’ 124 | operator>>(__ios_type& (__pf)(__ios_type&)) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:124:32: 附注: no known conversion for argument 1 from ‘node’ to ‘std::basic_istream::__ios_type& ()(std::basic_istream::__ios_type&)’ {aka ‘std::basic_ios& ()(std::basic_ios&)’} 124 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:131:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& ()(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 131 | operator>>(ios_base& (__pf)(ios_base&)) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:131:30: 附注: no known conversion for argument 1 from ‘node’ to ‘std::ios_base& ()(std::ios_base&)’ 131 | operator>>(ios_base& (__pf)(ios_base&)) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:168:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 168 | operator>>(bool& __n) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:168:24: 附注: no known conversion for argument 1 from ‘node’ to ‘bool&’ 168 | operator>>(bool& __n) | ^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:172:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits]’ 172 | operator>>(short& __n); | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:172:25: 附注: no known conversion for argument 1 from ‘node’ to ‘short int&’ 172 | operator>>(short& __n); | ~^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:175:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 175 | operator>>(unsigned short& __n) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:175:34: 附注: no known conversion for argument 1 from ‘node’ to ‘short unsigned int&’ 175 | operator>>(unsigned short& __n) | ~~~~^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:179:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits]’ 179 | operator>>(int& __n); | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:179:23: 附注: no known conversion for argument 1 from ‘node’ to ‘int&’ 179 | operator>>(int& __n); | ~^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:182:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 182 | operator>>(unsigned int& __n) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:182:32: 附注: no known conversion for argument 1 from ‘node’ to ‘unsigned int&’ 182 | operator>>(unsigned int& __n) | ~~~~^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:186:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 186 | operator>>(long& __n) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:186:24: 附注: no known conversion for argument 1 from ‘node’ to ‘long int&’ 186 | operator>>(long& __n) | ^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:190:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 190 | operator>>(unsigned long& __n) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:190:33: 附注: no known conversion for argument 1 from ‘node’ to ‘long unsigned int&’ 190 | operator>>(unsigned long& __n) | ~~~~~~~^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:195:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 195 | operator>>(long long& __n) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:195:29: 附注: no known conversion for argument 1 from ‘node’ to ‘long long int&’ 195 | operator>>(long long& __n) | ~~~^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:199:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 199 | operator>>(unsigned long long& __n) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:199:38: 附注: no known conversion for argument 1 from ‘node’ to ‘long long unsigned int&’ 199 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~^ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:214:7: 附注:candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream]’ 214 | operator>>(float& __f) | ^~ /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:214:25: 附注: no known conversion for argument 1 from ‘node’ to ‘float&’ 214 | operator>>(float& __f) |

                              • 0
                                @ 2026-8-13 14:41:41
                                #include<bits/stdc++.h>
                                using namespace std;
                                #define int long long
                                #define ull unsigned int
                                #define N 65536
                                int memory[N];
                                ull code[N] = {
                                // 将其复制进代码的第 8 行即可
                                0x2000000000000048, 0x1200000000000000,	//H
                                0x2000000000000065, 0x1200000000000000,	//e
                                0x200000000000006c, 0x1200000000000000,	//l
                                0x200000000000006c, 0x1200000000000000,	//l
                                0x200000000000006f, 0x1200000000000000,	//o
                                0x200000000000002c, 0x1200000000000000,	//,
                                0x2000000000000057, 0x1200000000000000,	//W
                                0x200000000000006f, 0x1200000000000000,	//o
                                0x2000000000000072, 0x1200000000000000,	//r
                                0x200000000000006c, 0x1200000000000000,	//l
                                0x2000000000000064, 0x1200000000000000,	//d
                                0x2000000000000021, 0x1200000000000000,	//!
                                0x200000000000000a, 0x1200000000000000,	//[\n]
                                0xf000000000000000	//exit
                                
                                };
                                /*
                                0 Input
                                1 Output
                                2 Write
                                3 Copy
                                4 Calculate (& | ~ ^ << >>)
                                5 Calculate (+ - * / %)
                                6 Goto
                                7 If-goto
                                8 x++
                                9 x--
                                f Exit
                                */
                                signed main()
                                {
                                	for(int i=0;;i=(i+1)%N)
                                	{
                                		int op=code[i]>>60;
                                		if(op==0)		//Input
                                		{
                                			int p=code[i]&65535;
                                			cin >> memory[ (code[i]>>56)&1 ? memory[p] : p ];
                                		}
                                		else if(op==1)	//Output
                                		{
                                			int p=code[i]&65535, val = memory[ (code[i]>>56)&1 ? memory[p] : p ];
                                			if((code[i]>>57)&1)
                                			{
                                				cout<<char(val&127);
                                			}
                                			else
                                			{
                                				cout<<val;
                                			}
                                		}
                                		else if(op==2)	//Write
                                		{
                                			int p = (code[i]>>32)&65535, val = code[i]&((1ll<<32)-1);
                                			memory[ (code[i]>>56)&1 ? memory[p] : p ] = val;
                                		}
                                		else if(op==3)	//Copy
                                		{
                                			int pf = (code[i]>>16)&65535, pt = code[i]&65535;
                                			int val = memory[ (code[i]>>55)&1 ? memory[pf] : pf ];
                                			memory[ (code[i]>>56)&1 ? memory[pt] : pt ] = val;
                                		}
                                		else if(op==4)	//Calculate (& | ~ ^ << >>)
                                		{
                                			int p1 = (code[i]>>32)&65535, p2 = (code[i]>>16)&65535, p3 = code[i]&65535;
                                			int val1 = memory[ (code[i]>>58)&1 ? memory[p1] : p1 ],
                                			val2 = memory[ (code[i]>>57)&1 ? memory[p2] : p2 ], val3;
                                			int op2 = (code[i]>>52)&15;
                                			if(op2==0)
                                			{
                                				val3=val1&val2;
                                			}
                                			else if(op2==1)
                                			{
                                				val3=val1|val2;
                                			}
                                			else if(op2==2)
                                			{
                                				val3=~val2;
                                			}
                                			else if(op2==3)
                                			{
                                				val3=val1^val2;
                                			}
                                			else if(op2==4)
                                			{
                                				val3=((val2>>6)?0:val1<<val2);
                                			}
                                			else
                                			{
                                				val3=((val2>>6)?0:val1>>val2);
                                			}
                                			memory[ (code[i]>>56)&1 ? memory[p3] : p3 ] = val3;
                                		}
                                		else if(op==5)	//Calculate (+ - * / %)
                                		{
                                			//想要乘方的建议自己写一个快速幂, 应该是能写的 
                                			int p1 = (code[i]>>32)&65535, p2 = (code[i]>>16)&65535, p3 = code[i]&65535;
                                			int val1 = memory[ (code[i]>>58)&1 ? memory[p1] : p1 ],
                                			val2 = memory[ (code[i]>>57)&1 ? memory[p2] : p2 ], val3;
                                			int op2 = (code[i]>>52)&15;
                                			if(op2==0)
                                			{
                                				val3=val1+val2;
                                			}
                                			else if(op2==1)
                                			{
                                				val3=val1-val2;
                                			}
                                			else if(op2==2)
                                			{
                                				val3=val1*val2;
                                			}
                                			else if(op2==3)
                                			{
                                				val3=(val2?val1/val2:0);
                                			}
                                			else
                                			{
                                				val3=(val2?val1%val2:0);
                                			}
                                			memory[ (code[i]>>56)&1 ? memory[p3] : p3 ] = val3;
                                		}
                                		else if(op==6)	//Goto
                                		{
                                			int p=code[i]&65535;
                                			i = (code[i]>>56)&1 ? memory[p] : p;
                                			i = (i+N-1)%N;
                                		}
                                		else if(op==7)	//If-goto (> < == >= <= !=)
                                		{
                                			int p1 = (code[i]>>32)&65535, p2 = (code[i]>>16)&65535, p3 = code[i]&65535;
                                			int val1 = memory[ (code[i]>>58)&1 ? memory[p1] : p1 ],
                                			val2 = memory[ (code[i]>>57)&1 ? memory[p2] : p2 ];
                                			int op2 = (code[i]>>52)&15;
                                			bool flag;
                                			if(op2==0)
                                			{
                                				flag=(val1>val2);
                                			}
                                			else if(op2==1)
                                			{
                                				flag=(val1<val2);
                                			}
                                			else if(op2==2)
                                			{
                                				flag=(val1==val2);
                                			}
                                			else if(op2==3)
                                			{
                                				flag=(val1>=val2);
                                			}
                                			else if(op2==4)
                                			{
                                				flag=(val1<=val2);
                                			}
                                			else
                                			{
                                				flag=(val1!=val2);
                                			}
                                			if(flag)
                                			{
                                				i = (code[i]>>56)&1 ? memory[p3] : p3;
                                				i = (i+N-1)%N;
                                			}
                                		}
                                		else if(op==8)	//x++
                                		{
                                			int p=code[i]&65535;
                                			memory[ (code[i]>>56)&1 ? memory[p] : p ]++;
                                		}
                                		else if(op==9)	//x--
                                		{
                                			int p=code[i]&65535;
                                			memory[ (code[i]>>56)&1 ? memory[p] : p ]--;
                                		}
                                		else if(op==15)	//Exit
                                		{
                                			break;
                                		}
                                		else
                                		{
                                			cout<<"\n\nError: Invalid code\n\n";
                                		}
                                	}
                                	return 0;
                                }
                                
                                
                                

                                信息

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