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

java:递归:10元钱按1,2,5元任意组合

package game;
public class Money {
 public static void main(String[] args) {
  fun("", 10);
  System.out.println("总共算法:" + i);
 }
 // 10元钱的组成,1,2,5任意组合
 public static int i = 1;
 public static void fun(String log, int n) {
  // int num = n;
  if (0 == n) {
   System.out.println(log.substring(0, log.length() - 1) + "=");
   return;
  } else if (1 == n) {
   System.out.println(log + "1" + "=");
   return;
  }
  if (n >= 1)
   fun(log + "1+", n - 1);
  if (n >= 2)
   fun(log + "2+", n - 2);
  if (n >= 5)
   fun(log + "5+", n - 5);
  i++;
 }
}


相关文档:

中国公历算法&中国农历算法(JAVA)

中国公历算法不是太难,关键是星期值的确定。这里给出了简单算法: 
public static int dayOfWeek(int y, int m, int d) {
int w = 1; // 公历一年一月一日是星期一,所以起始值为星期日
y = (y-1)%400 + 1; //&n ......

用Java操作Oracle日期类型字段

在java对oracle的操作中,日期字段是很头疼的事情,其实仔细研究一下也并不难掌握。
举个例子来说明:
表 book    中有name varchar2(20)//书籍名称,buydate Date //购买日期 两个字段。
已经创建了数据库连接Connection conn;
方法一、使用java.sql.Date实现比较简单的yyyy-mm-dd格式日期。
java.sql. ......

java:手写二叉树BinaryTree添加和查询方法

package arrays.myArray;
public class BinaryTree {
 private Node root;
 // 添加数据
 public void add(int data) {
  // 递归调用
  if (null == root)
   root = new Node(data, null, null);
  else
   addTree(root, data);
......

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 };
 & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号