getOutString 输出弹出字符串

输入字符串长度,字符串,计数m。从前往后计数,当数到m个元素时,第m个元素出列,同时将该元素赋值给m,然后从下一个数计数循环,直到所有数字都出列,给定的数全部为大于0的数字。输出出队队列。

    例如:  输入:len=4    str="3,1,2,4"   m=7   

             输出:2,3,1,4  

    函数原型

public String getOutString(int len, String str, int m) 

// 注意被除数  是变化的list长度

int location = (num-1) % list.size();

String insert = list.get(location);

result += insert;

//从下一位元素开始,变成第一位

num =  Integer.parseInt(list.get(location))+location;

原文地址:https://www.cnblogs.com/newcoder/p/5720443.html