Computation - Task 4
면접 대비시간 제한1초메모리 제한1024 MB
제한된 명령 집합을 사용해 주어진 실수 a의 절댓값을 계산하는 문제다.
문제
Given a task, you should write a program that solves the task using the instructions below. Let denote the result of the -th instruction. The permitted instructions, the syntax, and the result are given below:
Here, the definition of is given below where is the base of natural logarithm:
Notice there is a penalty for using the P, M, and * operators. See details below in the "grading" section.
For each instruction, the parameters and must be smaller than the current instruction number . The instructions are executed in the order, one by one.
The operations have finite precision: in particular, the results are only accurate up to 90 digits after the decimal point and the rest will be rounded. Similarly, the argument to the adding constant instruction can have at most 90 digits in its decimal part.
For left shift and right shift instructions, must be a non-negative integer not exceeding 10000.
The ten tasks are given below:
- Task 1: Given where and have at most 9 digits in their decimal parts, compute .
- Task 2: Given where and has at most 9 digits in its decimal part, compute .
- Task 3: Given where and has at most 9 digits in its decimal part, compute \left\\{ \begin{array}{ll} -1 & \quad a < 0\\\ 0 & \quad a = 0\\\ 1 & \quad a > 0 \end{array} \right..
- Task 4: Given where and has at most 9 digits in its decimal part, compute the absolute value of , .
- Task 5: Given where , treat as a binary number where is the most significant bit and is the least significant bit, compute the corresponding value (in base 10).
- Task 6: Given integer where , output 32 integers denoting in base 2 representation. The most significant bit should be printed first and the least significant bit should be printed last. If has less than 32 bits in its binary representation, add leading 0s.
- Task 7: Given integers where , compute the bitwise XOR of and .
- Task 8: Given where and has at most 9 digits in its decimal part, output .
- Task 9: Given where and has at most 9 digits in its decimal part, print 16 real numbers representing the result of sorting in ascending order.
- Task 10: Given integers where , , compute the remainder after dividing by (i.e. compute ).
출력
The -th line describes the -th instruction: first, you should output a letter denoting the operation. Then output several (or zero) integers denoting the parameters to the operation. The operator and the parameters (and between parameters) should be separated by a single space.
You can output at most lines.