Love丶FFC's Blog
一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置,即将A中的数据由(A0A1⋯AN−1)变换为(AN−M⋯AN−1A0A1⋯AN−M−1)(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法?
每个输入包含一个测试用例,第1行输入N(1≤N≤100)和M(≥0);第2行输入N个整数,之间用空格分隔。
在一行中输出循环右移M位以后的整数序列,之间用空格分隔,序列结尾不能有多余空格。
6 2
1 2 3 4 5 6
5 6 1 2 3 4
1.使用Python中列表截取的方法
新列表=原列表末尾+原列表开头
例如NON=6,MoveDistance=2,则先截取Number[6-2:](索引4,5的元素)
再截取Number[:6-2])(索引0,1,2,3的元素)
NON, MoveDistance = map(int, input().split()) Number = list(map(int, input().split())) Number = Number[NON - MoveDistance:] + Number[:NON - MoveDistance] # 按要求格式输出 for i in range(NON - 1): print(Number[i], end=" ") print(Number[NON - 1])
fruinly
If you want to change the Cockatiels staple diet e nolvadex for sale If the Qing Dynasty wants to build a space station, it can only belong to magic
FoorryNox
PMID 3756855 buy cialis canada pharmacy The glucometer measures glucose levels in a sample of your blood dabbed on a strip of treated paper
cheap louis vuitton handbags
Read reviews and was a little hesitant since I had already inputted my order. otherwise but thank god, I had no issues. for instance received item in a timely matter, they are in new condition. anyway so happy I made the purchase. Will be definitely be purchasing again.
cheap louis vuitton handbags https://www.louisvuittonsoutletstore.com/
louis vuitton outlet sale online
Read reviews and was a little hesitant since I had already inputted my order. or perhaps even but thank god, I had no issues. similar to received item in a timely matter, they are in new condition. in any event so happy I made the purchase. Will be definitely be purchasing again.
louis vuitton outlet sale online https://www.louisvuittonsoutletonline.com/
Preliaf
Gene expression signatures have helped us understand the inter tumor heterogeneity between breast cancer tumors 6, 7, separating tumors into subgroups with different underlying biology, prognosis, and treatment benefit 8, 9, 10 buy cialis online no prescription