当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7066:NJU emulator

Special Judge 特殊评判
题目描述
"Dr.JYY, s86 instruction set, and NEMU, what should that remind you of?"
"Oh, no..."


NJU Emulator(a.k.a, NEMU) is the latest s86 architecture simulator developed by Dr. JYY. s86 is stack-style computer architecture, with its machine instructions only operating on the top element of the stack. The computation model of s86 includes a stack and a program of finite length. Each element in the stack is in $64$-bit unsigned integer type; We denote the stack as $S$ and size of the stack as $size(S)$, then the program consists of the instructions in the following table and must end with a terminating instruction.
When the s86 machine is running, the stack will first be initialized to empty, and then each instruction in the program will be executed in sequence until the last one is executed.
After an end instruction, the machine will output the top element of the stack and halt.



In the table, the $x$th element refers to the $x$th element from the top to the bottom of the stack, where the topmost element is the $0$th element.

Notably, all arithmetic operations(add, sub, mul) in the s86 instructions should be done modular $2^{64}$, i.e., when the arithmetic operation has a result of $X$, the result in the s86 instruction set should be $X'(0\leq X'<2^{64})$, and $X-X'$ is a multiple of $2^{64}$, it can be shown that such $X'$ exist for any integer $X$.

Now that Dr. JYY has finished the development of NEMU. To test the correctness of NEMU, Dr. JYY wants you to write a program using s86 instructions, so that when the program halts, it should output the given integer $N$.


输入解释
The first line contains a number $T(1\leq T\leq 10000)$, denoting the number of test cases.

Each test contains an integer $N(0\leq N< 2^{64)}$ in one line, denoting the number your program should output when halts.
输出解释
For each test case, you should output a piece of program consisting of s86 instructions in the form as in the table in the statement so that when your program halts, it should output the given integer $N$. Also, your program should contain at most 50 s86 instructions. It is guaranteed that there exists at least one such program under the limits of this problem. If any restriction in the instruction table is violated during the execution of your program, your answer would be considered incorrect.

If many programs satisfy the restriction, you should output any such program, which will be considered correct.
输入样例
3
2
0
18446744073709551615
输出样例
p1
add 0
end
p1
dup
sub 1
end
p1
dup
add 1
swap
sub 1
end
来自杭电HDUOJ的附加信息
Hint The process of the execution of the last test case in the sample output is shown in the following table.

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7066

最后修改于 2021-10-23T19:11:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)