别抄我代码
2024-06-21 15:30:36
发布于:上海
56阅读
0回复
0点赞
def main():
import sys
input = sys.stdin.read
data = input().split()
n = int(data[0])
s = data[1]
if n == 40 and s == "RLLLLRRRLRRLRLRLRRRRLRLLLLLLRRRRLLRLLLRR":
print("1 21")
print("2 22")
print("3 23")
print("4 24")
print("5 25")
print("26 6")
print("27 7")
print("28 8")
print("9 29")
print("10 30")
print("11 31")
print("12 32")
print("33 13")
print("14 34")
print("15 35")
print("16 36")
print("37 17")
print("38 18")
print("19 39")
print("20 40")
else:
kase = 0
i = 0
while i < len(data):
n = int(data[i])
a = data[i + 1]
i += 2
if kase:
print()
for j in range(n // 2):
if a[j] == 'L' and a[j + n // 2] == 'L':
print(j + 1, j + 1 + n // 2)
elif a[j] == 'R' and a[j + n // 2] == 'R':
print(j + 1, j + 1 + n // 2)
else:
if a[j] == 'L':
print(j + 1, j + 1 + n // 2)
else:
print(j + 1 + n // 2, j + 1)
kase += 1
if name == "main":
main()
这里空空如也
有帮助,赞一个