
算法
竹丶墨
博客:https://hzyjoel.gitee.io/gitbook/
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
递归实现汉诺塔
public class test{ public static void main(String args[]){ int n=12;//需要移动的个数 moveto(12,'a','b','c'); } public static void moveto(int n,char a,char b,char c){ if(n==1){ System.out.printl...原创 2019-04-04 20:22:20 · 228 阅读 · 0 评论 -
分治法实现比赛日程安排
//比赛日程安排/****1 2 3 42 1 4 33 4 1 24 3 2 1 左上角与右下角相同,左下与右上相同*/public class test{ public static void main(String args[]){ int num=8;//比赛队伍数量必须是2的幂次数 int result[][]=new int[num][num];...原创 2019-04-04 20:23:48 · 440 阅读 · 0 评论 -
计算符匹配
//填写运算符问题 :5 5 5 5 5=5 在其中插入 + - * / 运算符使等式成立public class test { // 运算字符中是否只有加减法 static boolean justdoit = false; static int sum = 5; public static void main(String args[]) { test t = new tes...原创 2019-04-04 20:25:44 · 225 阅读 · 0 评论 -
贪婪算法实现找零
//贪婪算法实现找零public class test{ double[] rmbnum={100,50,20,10,5,10,1,0.5,0.1}; public static void main(String args[]){ double rmb=61.5; test t=new test(); rmbback r=t.reback(782);// while(r!=n...原创 2019-04-04 20:26:32 · 710 阅读 · 0 评论 -
贪婪算法实现装箱
//贪婪算法实现装箱操作public class test { public static void main(String args[]) { huowu[] h = new huowu[5]; h[0] = new huowu(10); h[1] = new huowu(80); h[2] = new huowu(50); h[3] = new huowu(50); ...原创 2019-04-04 20:27:42 · 1260 阅读 · 0 评论