시간 제한 | 메모리 제한 | 제출 | 정답 | 맞은 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 5 | 1 | 1 | 20.000% |
You are given $N$ pairs of integers $(x_i, y_i)$. Construct a function $f$ that satisfies $y_i = f(x_i)$ for each $i$. It must be possible to write the function $f$ in the C programming language in the following form:
uint32_t f(uint32_t x) { return Expression; }
Here, uint32_t
is an unsigned 32-bit integer. The Expression must satisfy the following BNF:
<expr> ::= "x" | <num> | "(~" <expr> ")" | "(" <expr> <op2> <expr> ")" <op2> ::= "&" | "|" | "^" | "+" | "-" | "*"
Here, <num>
is an unsigned 32-bit integer represented as a decimal number. It must not contain leading zeroes, except if it is zero itself which must be represented as $0$.
The first line contains an integer $N$ ($1 \le N \le 8$).
The $i$-th of the next $N$ lines contains two integers $x_i$ and $y_i$ ($0 \le x_i, y_i < 256$).
Print an expression that satisfies the conditions.
The output must strictly follow the BNF format in the statement. Extra whitespaces, newlines, parentheses, etc.~are not allowed. The output must contain at most $10^5$ characters. It is guaranteed that the answer exists for the given input.
8 1 1 2 2 3 3 4 0 5 1 6 2 7 3 8 0
(x&3)
8 1 0 2 0 3 2 4 0 5 4 6 4 7 6 8 0
(x&(x-1))