题解 | #MP3光标位置#
MP3光标位置
https://www.nowcoder.com/practice/eaf5b886bd6645dd9cfb5406f3753e15
def ud(s): if s=="U": return -1 else: return 1 num=int(input()) s=input() totsong=[i for i in range(1,num+1)] site=0 lssong=[] if num<=4: lssong=totsong for x in s: site=(site+ud(x))%num else: lssong=totsong[:4] for x in s: site=(site+ud(x))%num if site==num-1: lssong=totsong[num-4:] elif site==0: lssong=totsong[:4] elif totsong[site] not in lssong: if x=="U": lssong=totsong[site:site+4] else: lssong=totsong[site-3:site+1] print(" ".join(map(lambda x:str(x),lssong))) print(site+1)