1251 : Memory
| 比对Compare | token 相同即通过。中间的空格、制表符、换行可多可少。Matching tokens pass. Extra spaces, tabs, or newlines between them are ignored. |
|---|---|
| 不同则错Differs | token 个数或内容不同即错误。23 与 2 3、02 与 2、2.0 与 2 均视为不同。A different token count or value is wrong. 23 vs 2 3, 02 vs 2, and 2.0 vs 2 all differ. |
| 输入Input | 标准输入,格式见题面。Standard input; format as in the statement. |
| 输出Output | 标准输出。Standard output. |
题目描述Description
\(\textit{Singing a song with cups of drink, That days are short is what I think. They are like dews in morning early, Therefore, I feel suffered for time gone surely.}\)
Little G used to be a participant in programming contests and he had attended \(n\) contests in total, and for the \(i\)-th contest, Little G got \(a_i\) happiness. However, Little G would also be influenced by past contests since memory also plays an important role to influence one’s mood. So we can use following formula to value Little G’s mood after the \(i\)-th contest: \[ Mood(i) = \sum_{j=1}^{i}2^{j-i}\times a_j\]
Now Little G is recalling the past and is curious about the moods
after every contest, so he wants to tag the moods for every contest.
Specifically, Little G will tag a positive sign (+) for the
\(i\)-th contest if \(Mood(i) > 0\), or tag a negative sign
(-) if \(Mood(i) < 0\),
or tag a zero (0) if \(Mood(i) =
0\). But Little G is busy working and working, so he is now
asking you, the best programming contestant, to help him tag the
moods.
输入格式Input
The first line contains one integers \(n\) (\(1\le n\le 10^5\)), denoting the number of contests Little G had attended.
The second line contains \(n\) integers \(a_1, a_2, \ldots, a_n\) (\(-10^9 \le a_i \le 10^9\)), denoting the happiness values after every contest.
输出格式Output
Output one line containing a string which is of length \(n\) and only contains +,
- or 0, denoting the mood tags after every
contest.
样例Sample
提示Hint
- \(Mood(1) = 2^0\times 2 = 2 > 0\)
- \(Mood(2) = 2^{-1}\times 2 + 2^0\times(-1) = 0\)
- \(Mood(3) = 2^{-2}\times 2 + 2^{-1}\times(-1) + 2^0\times 4 = 4 > 0\)
- \(Mood(4) = 2^{-3}\times 2 + 2^{-2}\times(-1) + 2^{-1}\times 4 + 2^0\times (-7) = -5 < 0\)
- \(Mood(5) = 2^{-4}\times 2 + 2^{-3}\times(-1) + 2^{-2}\times 4 + 2^{-1}\times (-7) + 2^0\times 4 = \frac{3}{2} > 0\)
出题Author
FUDAN