题解 | #MP3光标位置#
MP3光标位置
http://www.nowcoder.com/practice/eaf5b886bd6645dd9cfb5406f3753e15
def dy4(a, b):
start = 1
end = 4
gb = 1
for i in b:
if i == "D":#下翻
gb += 1
if gb <= end:
pass
else:
if gb > a:
gb = gb % a
start =1
end = 4
else:
start += 1
end += 1
else:#上翻
gb -= 1
if gb >= start:
pass
else:
if gb < 1:
gb += a
start = a-3
end = a
else:
start -= 1
end -= 1
return ("{} {} {} {}".format(start,start +1, end - 1, end),gb)
while True:
try:
a = input()
b = input()
except:
break
else:
if int(a)< 4:
print(" ".join([str(i) for i in range(1, int(a)+1)]))
if a == "1":
print(1)
else:
print(dy4(int(a), b)[1])
else:
print(dy4(int(a), b)[0])
print(dy4(int(a), b)[1])