4.29python
題目:
?
?
代碼:(?)
list = input().split()
list1 = []
list2 = []
for i in range(len(list)):
if (i+1)%3 != 0 and (i+1)%2 == 0:
list1.append(int(list[i]))
elif (i+1)%3 == 0:
list2.append(int(list[i]))
list1.sort()
list2.sort(reverse = True)
j,k = 0,0
for i in range(len(list)):
if (i+1)%3 != 0 and (i+1)%2 == 0:
del list[i]
list.insert(i,str(list1[j]))
j += 1
elif (i+1)%3 == 0:
del list[i]
list.insert(i,str(list2[k]))
k += 1
print(' '.join(list))
---------------------
作者:GrWx
來源:CSDN
原文:https://blog.csdn.net/and_w/article/details/50768811
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!
?
轉載于:https://www.cnblogs.com/P201821430045/p/10791012.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的4.29python的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 宕机了,Redis数据丢了怎么办?
- 下一篇: Codeforces 1015F Bra