5959: 【系列题】单调栈(一)每日温度
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:4
Solved:3
Description
给定一个长度为 n 的整数数组 temperatures[] ,表示每天的温度,计算一个数组 answer[],其中 answer[i] 是指对于第 i 天,下一个更高温度出现在几天后。如果气温在这之后都不会升高,请在该位置用 0 来代替。
Input
第一行一个整数 n。
第二行 n 个 整数 temperatures[i]。
Output
一行 n 个整数 answer[i]。
Sample Input Copy
8
73 74 75 71 69 72 76 73
Sample Output Copy
1 1 4 2 1 1 0 0
HINT
数据范围:
- 1 <= n <= 105
- 30 <= temperatures[i] <= 100