Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
数组循环移位
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 144, Accepted users: 51
Problem 10436 : No special judgement
Problem description
  设计一个算法,把一个含有N个元素的数组循环右移K位,要求时间复杂度为O(N),且只允许使用两个附加变量。

Input
  第一行一个正整数T,表示有T组测试数据。每组测试数据由两行组成,第一行是两个整数NK,表示将N个元素的数组循环右移K位,第二行是数组的N个元素。 (N<=10000)

Output
  输出循环右移K位后的数组元素。

Sample Input
2
4 10
df12
8 4
abcd1234
Sample Output
12df
1234abcd
Problem Source
  qshj

Submit   Discuss   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2311 today,16259038 total, since 2010-05-07