CF468A 24 Game to find the law

(Translated version from Luogu by lonelysir)

Title Description

X've always liked a little card game: "24 points", but recently he found the game too easy, so he invented a new game.

Do you have a sequence of integers, including integers n: 1,2,3, ..., n. The steps are simple, from which you can come up with two numbers, we assume that a and B are, removed from the two sequence numbers, and a + b, ab, or into the sequence of a × b.

After n-1 operations, leaving only a sequence number, you can turn out to be the number 24 do?

Input Format

Line, comprising a number n. Output Format

If 24 can be calculated through the operation, then the first line of output "YES", and otherwise outputs "NO".

Under the premise can, the next (n-1 \) \ rows, each row outputs a calculation operation of the form "a op b = c", a and b represent the number of your choice, and op, is computing symbol you use (add, subtract, or multiply). Expression in \ (abs (c) \) will not exceed \ (| 10 ^ 8 | \ )

Output Format

There must be a space between the characters and the digital output of each Note of expression.

If you have multiple solution, output any one can

Sample input and output

Input # 1
. 1
Output # 1
NO
Input # 2
. 8
outputs # 2
YES
. 8 * = 56 is. 7
. 6. 5 * = 30
. 3 -. 4 = -1
. 1 - 2 -1 =
30 - 31 is -1 =
56 is - 31 is 25 =
25 -1 = 24 +

——————————————————————————————————————————

Guess you like

Origin www.cnblogs.com/zhwer/p/12194879.html
law