摘要: C#实现 class Program { static string temp = ""; static int count = 0; static void Main(string[] args) { int[] arr = {1,2,3,4,5,6,7,8}; GetNumber(arr,5,"",""); } public static void GetNumber(int[] array, int round, string strNum,string ... 阅读全文
posted @ 2013-12-02 11:34 王国营的博客 阅读(827) 评论(0) 推荐(0) 编辑
摘要: 约瑟夫环是一个数学的应用问题:已知16个人(以编号0,1,2...15分别表示)围坐在一张圆桌周围。从编号为0的人开始报数(报数从1开始),数到3的倍数的那个人出列;直到圆桌剩下一个,请打印出每个人出列的编号C#非递归发实现static void Main(string[] args) { //保存移走的人的个数 int RemoveCount = 0; //保存每个人读出的数字 int ReadCount = 0; int[] personNum = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; while (tr 阅读全文
posted @ 2013-12-02 11:30 王国营的博客 阅读(259) 评论(0) 推荐(0) 编辑