2017年5月29日 星期一

2017年5月22日 星期一

b547 巧克力口味

/* b547-巧克力口味 */ #include <iostream> #include <sstream> #include <iomanip> #include <cstring> #include <cstdio> #include <vector> #include <map> #include <set> #include <algorithm> using namespace std; const int MaxR = 10; set <string> rel[MaxR];  // 最多 10 種 關係 map <int , int> c2n; string rs(8,'?'); string c6(6,' '); int getn(int...

2017年5月21日 星期日

vb版 BST建立及巡訪

一個TextBox1輸入5~30個皆不相同的整數以「,」隔開 一個Label1顯示輸出 一個按鈕,執行(1)建二元搜尋樹,(2)在Label1顯示{前序、中序、後序}巡訪結果 程式碼如下: Public Class Form1     Class BT         Public data As Integer         Public lch As BT         Public rch As BT         Sub New()             lch = Nothing        ...

2017年5月20日 星期六

b549 數位相片檔名

/* b549 nr102-5 北二區102年-5 數位相片檔名  */ #include <iostream> #include <iomanip> #include <set> #include <map> using namespace std; map<int,int> used;                   // 已使用的 <時間 , 檔名> map<int,int>::iterator mit; map<int,int>::reverse_iterator rit; bool can(int fn)            ...

2017年5月2日 星期二

Z2A,Z1A求組合數

4/28中午及5/1晚上加強,Z2A三位、Z1A三位,共6位到課 Vb2010 -Windows Form專案: 四個按鈕、二個文字方塊(輸入m,n),一個標籤(輸出) M取N求組合數(二項係數) 0<=N<=M<=66,分四種解法程式碼如下:     Dim c(66, 66) As Long  '第4種解法使用 '解法一:呼叫函式 pk(k) 算出 k階乘 值,  0<=k<=66 ,但k=21 時溢位     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click         Dim m As...

Z2A河內塔範例

4/26中午加強,Z2A三位學生到課 Vb2010 -Windows Form專案: 一個按鈕、一個文字方塊,以debug.print輸出至即時運算視窗 程式碼如下:   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click         Dim n As Integer = TextBox1.Text         ho(n, "A", "B", "C")     End Sub     Sub ho(ByVal n As Integer, ByVal a As Char, ByVal b As...

2017年5月1日 星期一