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

建议使用的浏览器:

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

5308:I Wanna Become A 24-Point Master

Special Judge 特殊评判
题目描述
Recently Rikka falls in love with an old but interesting game -- 24 points. She wants to become a master of this game, so she asks Yuta to give her some problems to practice.

Quickly, Rikka solved almost all of the problems but the remained one is really difficult:

In this problem, you need to write a program which can get 24 points with $n$ numbers, which are all equal to $n$.
输入解释
There are no more then 100 testcases and there are no more then 5 testcases with $n \geq 100$. Each testcase contains only one integer $n\ (1 \leq n \leq 10^5)$
输出解释
For each testcase:

If there is not any way to get 24 points, print a single line with -1.

Otherwise, let $A$ be an array with $2n-1$ numbers and at firsrt $A_i=n\ (1 \leq i \leq n)$. You need to print $n-1$ lines and the $i$th line contains one integer $a$, one char $b$ and then one integer c, where $1 \leq a,c <n+i$ and $b$ is "+","-","*" or "/". This line means that you let $A_a$ and $A_c$ do the operation $b$ and store the answer into $A_{n+i}$.

If your answer satisfies the following rule, we think your answer is right:

1. $A_{2n-1}=24$

2. Each position of the array $A$ is used at most one tine.

3. The absolute value of the numerator and denominator of each element in array $A$ is no more than $10^9$
输入样例
4
输出样例
1 * 2
5 + 3
6 + 4
来自杭电HDUOJ的附加信息
Author XJZX
Recommend wange2014

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

源链接: HDU-5308

最后修改于 2020-10-25T23:21:33+00:00 由爬虫自动更新

共提交 0

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