摘要: import org.apache.commons.collections4.Bag; import org.apache.commons.collections4.bag.TreeBag; import java.util.Arrays; public class ApacheTreeBag { public static void main(String[] args) { ... 阅读全文
posted @ 2017-01-22 22:11 少於無 阅读(382) 评论(0) 推荐(0)
摘要: 1 /* 2 * 馬踏棋盤問題:(貪婪法求解) 3 * 棋盤有64個位置,“日”字走法,剛好走滿整個棋盤 4 */ 5 6 //下一個走法的方向類 7 class Direction{ 8 int x; 9 int y; 10 int wayOutNum; 11... 阅读全文
posted @ 2017-01-11 14:35 少於無 阅读(194) 评论(0) 推荐(0)
摘要: 1 /** 2 * 雞兔同籠問題:窮舉算法思想 3 */ 4 import java.util.*; 5 public class ChichenAndHabbit { 6 static int chichenNum,habbitNum; 7 public static void main(String[] args) { 8 int head... 阅读全文
posted @ 2017-01-11 14:30 少於無 阅读(595) 评论(0) 推荐(0)
摘要: 題目:如果一對兩個月大的兔子以後每個月可以生一對兔子,而一對新生的兔子出生兩個月後纔可以生兔子。也就是說1月份出生的3月份才能生子。假定一年內兔子沒有死亡事件,那麼一年後共有多少對兔子。 阅读全文
posted @ 2017-01-11 14:15 少於無 阅读(300) 评论(0) 推荐(0)
摘要: 1 import java.util.Arrays; 2 3 publicclass HeapSort { 4 inta[]={49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,98,54,56,17,18,23,34,15,35,25,53,51}; 5 public HeapSort(){ 6 heapS... 阅读全文
posted @ 2017-01-04 23:53 少於無 阅读(292) 评论(0) 推荐(0)
摘要: 1 * 快速排序法(Quick Sort),遞迴版本。 2 * 3 * @param array 傳入要排序的陣列 4 * @param start 傳入要排序的開始位置 5 * @param end 傳入要排序的結束位置 6 */ 7 public static void quickSortRecursive(final int[] array, final int start,... 阅读全文
posted @ 2017-01-03 17:19 少於無 阅读(185) 评论(0) 推荐(0)
摘要: 1 public class Josephus { 2 public static int[] arrayOfJosephus( int number, int per) { 3 4 int[] man = new int[number]; 5 6 for(int count = 1, i = 0, pos = -1; ... 阅读全文
posted @ 2016-12-29 22:48 少於無 阅读(198) 评论(0) 推荐(0)
摘要: 1 2 3 #ff7fa87f 4 @*android:color/black 5 @*android:color/black 6 #ffeeeeec 7 #fff1f1f1 8 #ffaaaaaa 9 #ffededed10 #... 阅读全文
posted @ 2015-07-19 11:37 少於無 阅读(273) 评论(0) 推荐(0)
摘要: 1 package com.myhost; 2 3 import android.os.Bundle; 4 import android.view.LayoutInflater; 5 import android.widget.TabHost; 6 import android.app.TabA... 阅读全文
posted @ 2015-07-18 21:09 少於無 阅读(189) 评论(0) 推荐(0)
摘要: 1 package com.example.ele_me.activity; 2 3 import android.annotation.SuppressLint; 4 import android.app.Activity; 5 import android.os.Bundle; 6 impo... 阅读全文
posted @ 2015-06-03 14:44 少於無 阅读(217) 评论(0) 推荐(0)