原创 杭電ACM 1089-1096

這幾道題與算法無關,純粹熟練輸入輸出。 1089 .A+B for Input-Output Practice (I) http://acm.hdu.edu.cn/showproblem.php?pid=1089 import java.

原创 杭電ACM1003,1004,1005 java解答

1003 . Problem Description Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequen

原创 杭電ACM 1008 1009

1008 .Elevator Problem Description The highest building in our city has only one elevator. A request list is made up w

原创 杭電ACM 1017 1018 1019

1017 .A Mathematical Curiosity Problem Description Given two integers n and m, count the number of pairs of integers (

原创 杭電ACM 1012 1013 1014

1012 . u Calculate e Problem Description A simple mathematical formula for e is where n is allowed to go to infinity.

原创 回溯法(1)

回溯法(探索與回溯法)是一種選優搜索法,又稱爲試探法,按選優條件向前搜索,以達到目標。但當探索到某一步時,發現原先選擇並不優或達不到目標,就退回一步重新選擇,這種走不通就退回再走的技術爲回溯法,而滿足回溯條件的某個狀態的點稱爲“回溯點”

原创 杭電ACM1098 Ignatius's puzzle

Problem Description Ignatius is poor at math,he falls across a puzzle problem,so he has no choice but to appeal to Edd

原创 杭電ACM1006 Tick and Tick

Problem Description The three hands of the clock are rotating every second and meeting each other many times everyday.

原创 杭電ACM1060 Leftmost Digit

Problem Description Given a positive integer N, you should output the leftmost digit of N^N. Input The input contains

原创 (原創)一般矩陣 Matrix類

討論矩陣的兩種表示方法,一種用一維數組來存儲矩陣元素,另一種用二維數組來存儲矩陣元素。然後比較兩種方法,並測試它們的性能,做出總結。 1.一維數組形式 主要代碼: public class Matrix implements Clon

原创 杭電ACM1000,1001,1002 java解答

1000 . Problem Description Calculate A + B. Input Each line will contain two integers A and B. Process to end of fil

原创 堆棧和隊列的java實現

1.堆棧 堆棧是一種後進先出(LIFO)的數據結構。主要要實現的方法有判斷堆棧是否爲空,輸出堆棧的頂部元素,添加元素,刪除元素,創建一個包含這幾個方法的接口如下: public interface Stack { public

原创 (原創)Hanoi塔問題的遞歸方法與非遞歸方法(java實現)

本文討論了Hanoi塔問題的遞歸方法與非遞歸方法,給出了java實現的代碼,並比較了它們的效率。 法國數學家愛德華·盧卡斯曾編寫過一個印度的古老傳說:在世界中心貝拿勒斯(在印度北部)的聖廟裏,一塊黃銅板上插着三根寶石針。印度教的主神梵天