易截截图软件、单文件、免安装、纯绿色、仅160KB

java:递归汉罗塔游戏最少的走法

package game;
public class HanTaGame {
 public static void main(String[] args) {
  fun('1', '2', '3', 2);
 }
 // 汉塔游戏解决方案
 public static void fun(char src, char idle, char dest, int n) {
  if (1 == n) {
   System.out.println(src + "--->" + dest);
   return;
  }
  //定义一个顺序
  fun(src, dest, idle, n - 1);
  System.out.println(src + "--->" + dest);
  //进行顺序的交换
  fun(idle, src, dest, n - 1);
 }
}


相关文档:

java:经典文件写入和读取,速度超快

package arrays.file;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamRea ......

java:三种经典大排序汇总,冒泡,插入,选择

package arrays.myArray;
public class SortArr {
 public static void main(String[] args) {
  int[] arrInt = { 4, 7, 8, 5, 6, 3, 2, 3, 4 };
  maoPaoSort(arrInt);
  print("冒泡排序:", arrInt);
  arrInt = new int[]{ 4, 7, 8, 5, 6, 3, 2, 3, 4 };
 & ......

java:Student类

package collection;
public class Student {
 
 public Student() {}
  
 public Student(String name, String sex, int age) {
  this.name = name;
  this.sex = sex;
  this.age = age;
 }
 @Override
 public String toString() { ......

java:递归:上楼梯每次只能一步或者两步,有多少走法

package floatt;
public class Go {
 public static int i = 0;
 public static void main(String[] args){
  calc("", 5);
  System.out.println("总共有"+i+"种走法~");
 }
 
 //上楼梯每次只需一步或者两步,有多少走法
 public static void calc(String lo ......

java:递归:10的阶乘

package game;
public class JieCeng {
 public static void main(String[] args){
  System.out.println(fun(10));
 }
 
 public static int fun(int n){
  if(1==n)
   return 1;
  System.out.println( n * fun(n-1));
  return ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号