ZipRecruiterOA #13
Time Travel
估计简单可在线判题
考点(AI 标注)原地数组模拟/实现
Visit a list of years in the given order. Moving between equal adjacent years costs 0; going to a later year costs 1; going back to an earlier year costs 2. Find the total time.
输入格式
The first line contains n (1..100); the second line contains n years (1..10000).
输出格式
Output the total time.
样例 1
输入:
4
2000 1990 2005 2050
输出:
4
样例 2
输入:
3
2000 2021 2005
输出:
3
样例 3
输入:
3
2021 2021 2005
输出:
2