因为list里的数字都是连续的,所以题目并不难,但要特殊判断结尾的15和0
n = int(raw_input())
themoon = map(int,raw_input().split())
if len(themoon) == 1:
if themoon[0] == 15:
print "DOWN"
elif themoon[0] == 0:
print "UP"
else:
print -1
else:
a = themoon[-1]
b = themoon[-2]
if a - b > 0:
if a == 15 and b == 14:
print "DOWN"
else:
print "UP"
elif a - b < 0:
if a == 0 and b == 1:
print "UP"
else:
print "DOWN"
本文介绍了一种通过输入一系列整数来判断月相变化的方法,特别关注于如何处理连续数字序列中的特殊情况,如序列以15或0结束的情况。
668

被折叠的 条评论
为什么被折叠?



