上一页 1 2 3 4 5 6 7 8 9 10 ··· 16 下一页

2010年7月23日

信手胡写二分法

摘要: /** * 几个二分法 * 使用二分法的前提是数组已经排好序 * * @author tiger */ public class erfenfa { /** * 中间调用多个自身方法 */ public void erFenFa(int[] array, int fromIndex, int toIndex, int goal){ if(fromIndex > to... 阅读全文

posted @ 2010-07-23 18:50 台哥编程课堂 阅读(135) 评论(0) 推荐(0) 编辑

简单起名程序

摘要: /** * 简单起名程序 * * 源于公司游戏起名,随手而写。 * * @author tiger * */public class NAME { public static void main(String[] args) { String[] str = new String[]{"刀","剑","奇","侠","魔","武","林","狂","舞","龙","云",&qu 阅读全文

posted @ 2010-07-23 18:49 台哥编程课堂 阅读(306) 评论(0) 推荐(0) 编辑

2010年6月6日

开发笔记一

摘要: j2se中加载图片等资源:如果加载不能成功,测试该方法,定能找到问题所在。public class NewMain {public NewMain () { System.out.println(this.getClass().getResource("")); System.out.println(this.getClass().getResource(".")); System.out.println(this.getClass().getResource("..")); System.out.println(this.getCl 阅读全文

posted @ 2010-06-06 13:34 台哥编程课堂 阅读(150) 评论(0) 推荐(0) 编辑

打印数字521,笔画由汉字组成

摘要: /** * 打印数字521,笔画由汉字组成。 * @author tiger * @date 2010-5-21 */ public class wueryi { private int[][] array = { {1,1,1,0,2,2,2,0,0,3}, {1,0,0,0,0,0,2,0,0,3}, {1,1,1,0,2,2,2,0,0,3}, {0... 阅读全文

posted @ 2010-06-06 13:24 台哥编程课堂 阅读(528) 评论(0) 推荐(0) 编辑

递归算法生成数独

摘要: /*** * 递归方法生成数独* * @author tiger* @date 2010-5-28 完成于公司* * 复杂度有点高,有空优化。*/public class sodu {private int[][] sodu = null;private int[] tai = null;/** * 构造方法 * 因为每执行一次递归都会把数组tai元素全置为-1. * 所以在执行一次递归后需要重新给tai赋值。 */public sodu(){do{this.init();tai = getMixArray();tiger(0,0,0,0); //uplefttai = getMixArray 阅读全文

posted @ 2010-06-06 13:21 台哥编程课堂 阅读(1096) 评论(0) 推荐(0) 编辑

矩阵行列变换生成伪数独

摘要: /*** * @author tiger* @date 2010-5-28 18:54 于公司* ** 注: 先随机生成最中间的3*3矩阵* 对这个小矩阵进行适当的行变换和列变换* 把生成的新矩阵赋值到9*9数独矩阵的适当位置。* 即可生成一个数独。* * 不过,既然是按照一定的行列变换来生成的。* 有了确定的规律,所以生成的数独看上去也就是有规律的。* 算是个最简单的数独吧,适合1-2年级的小学生玩。*/public class sodu2 {public sodu2(){this.mix(array);this.initCenter();this.initOther();this.comp 阅读全文

posted @ 2010-06-06 13:21 台哥编程课堂 阅读(562) 评论(0) 推荐(0) 编辑

3D魔方源码

摘要: import java.awt.*;import java.applet.Applet;public final class rubik extends Applet{ int i; int j; int k; int n; int o; int p; int q; int lastX; int lastY; int dx; int dy; int rectX[]; int rectY[]; Color colList[]; Color bgcolor; final double sideVec[] = { 0.0, 0.0, 1.0, 0.0, 0.0, -1, 0.0, -1, 0.0, 阅读全文

posted @ 2010-06-06 13:18 台哥编程课堂 阅读(454) 评论(1) 推荐(0) 编辑

判断数组元素是否从1到9

摘要: /*** 判断数组元素是否从1到9* @author tiger**/public class kuangda {int flag = 0x3fe;int[] array = new int[]{2,1,3,9,5,6,7,8,4};private boolean isYesArray(){for (int i = 0; i < array.length; i++) {int abc = 0;abc = flag & (1 << array[i]);flag = flag - abc;if(abc == 0)return false;}return true;}/** 阅读全文

posted @ 2010-06-06 13:14 台哥编程课堂 阅读(240) 评论(0) 推荐(0) 编辑

2010年5月27日

几个二分法示例

摘要: /*** 几个二分法* @author tiger*/public class Test {/** * 中间调用多个自身方法 */public void erFenFa(int[] array, int fromIndex, int toIndex, int goal){if(fromIndex > toIndex){ // 这一句非常重要!return;}int middle = (fromIndex + toIndex) / 2;if(array[middle] == goal){System.out.println(goal + "在数组中的索引是:" + mi 阅读全文

posted @ 2010-05-27 19:12 台哥编程课堂 阅读(239) 评论(0) 推荐(0) 编辑

标点引起的一个程序错误

摘要: //今天发现个问题,十分怪异的。//检查了半天才发现是多写了个标点";". 晕!public class tiger {public static void main(String[] args) {if(2 > 1){System.out.println("hehehehe");}// 因为这里多加了一个分号 ";" ,以致还是会打印hehehehe.// 所以:写代码一定要小心!检查代码一定要仔细!if(1 > 2);{System.out.println("hehehehe");}//如此括号内的 阅读全文

posted @ 2010-05-27 19:11 台哥编程课堂 阅读(150) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 16 下一页

导航