Computation - Task 6
Time limit1sMemory limit1024 MB
Write an instruction-set program for ten fixed tasks, including XOR, a*b mod m, and sorting 16 reals, using only the listed operators.
- Level
Medium6 of 10
- Topics
- Implementation, Bit manipulation, Sorting
- Solved
- No attempts yet
Problem
You need to 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.
The function is defined below, where is the base of the natural logarithm.
The P, M, and * operators incur a penalty. See the "grading" section below for details.
Instructions run in order, one at a time. For each instruction, the parameters and must be smaller than the current instruction number . Operations have finite precision. Results are accurate only up to 90 digits after the decimal point, and the rest is rounded. The argument of the adding constant instruction has at most 90 digits in its decimal part. For the left and right shift instructions, must be a non-negative integer not exceeding 10000.
Tasks
- 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 if , if , and if .
- Task 4: Given where and has at most 9 digits in its decimal part, compute the absolute value .
- Task 5: Given where each , treat as a binary number where is the most significant bit and is the least significant bit. Compute its value in base 10.
- Task 6: Given an integer where , output 32 integers giving in base 2. Print the most significant bit first and the least significant bit last. If has fewer than 32 bits, 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 each has at most 9 digits in its decimal part, print 16 real numbers that are sorted in ascending order.
- Task 10: Given integers where and , compute the remainder when is divided by , that is, .
Output
The -th line describes the -th instruction. First, output a letter for the operation. Then output zero or more integers for its parameters. Separate the operator and the parameters, and separate the parameters from each other, with a single space.
You can output at most lines.