1251 : Memory
- 时间限制Time Limit
- 1 秒Sec
- 内存限制Memory Limit
- 256 兆MB
- 提交次数Submitted
- 579 次Times
- 通过次数Solved
- 126 次Times
| 比对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. |
| 时间与内存Time and memory | 记这一份程序的 CPU 时间和内存峰值。题目上的时间限制、内存限制就是这一份的上限。The record is this program’s CPU time and peak memory. The limits on the problem apply to this one run. |
题目描述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