• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 70  文章 - 160  trackbacks - 0

            公告:
            知識(shí)共享許可協(xié)議
            本博客采用知識(shí)共享署名 2.5 中國大陸許可協(xié)議進(jìn)行許可。本博客版權(quán)歸作者所有,歡迎轉(zhuǎn)載,但未經(jīng)作者同意不得隨機(jī)刪除文章任何內(nèi)容,且在文章頁面明顯位置給出原文連接,否則保留追究法律責(zé)任的權(quán)利。 具體操作方式可參考此處。如您有任何疑問或者授權(quán)方面的協(xié)商,請給我留言。

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            搜索

            •  

            積分與排名

            • 積分 - 179471
            • 排名 - 147

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 經(jīng)典的遞歸問題,遞歸+回溯解決。 注意代碼中select_combination()的應(yīng)用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 // POJ 2245 // Tanky Woo // www.wutianqi.com #include<iostream> #include<algorithm> using namespace std; int num[14]; int lotto[14]; int n,cnt;   void select_combination(int current,int p)//遞歸填充數(shù)并打   印組合,相當(dāng)于DFS過程 { int i; if(6 == current) { for(i = 0; i < 6; ++i) printf("%d ", lotto[i]); printf("\n"); } else { for(i = p; i < n; ++i) { lotto[current] = num[i]; select_combination(current+1,   i+1); } } }   // www.wutianqi.com int main() { [...]
            文章來源:http://www.wutianqi.com/?p=287
            posted @ 2010-07-08 18:33 Tanky Woo 閱讀(147) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 經(jīng)典的遞歸問題,遞歸+回溯解決。 注意代碼中select_combination()的應(yīng)用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 // POJ 2245 // Tanky Woo // www.wutianqi.com #include<iostream> #include<algorithm> using namespace std; int num[14]; int lotto[14]; int n,cnt;   void select_combination(int current,int p)//遞歸填充數(shù)并打   印組合,相當(dāng)于DFS過程 { int i; if(6 == current) { for(i = 0; i < 6; ++i) printf("%d ", lotto[i]); printf("\n"); } else { for(i = p; i < n; ++i) { lotto[current] = num[i]; select_combination(current+1,   i+1); } } }   // www.wutianqi.com int main() { [...]
            文章來源:http://www.wutianqi.com/?p=287
            posted @ 2010-07-08 18:33 Tanky Woo 閱讀(85) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 很經(jīng)典的遞歸! 把握前序,中序,后序的特點(diǎn)。 前序的第一個(gè)元素是樹的根,在相應(yīng)中序中根以左是左子樹,根以右是右子樹。 注意考慮 n == 1和 n == 0 的情況。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 // POJ 2255 Tree Recovery // Tanky Woo // Memory: 180K Time: 0MS // Language: C++ Result: Accepted   #include <iostream> #include <string> using namespace std;   //定義前序,中序,后序序列 string preord, inord, postord; void find_postord(string preord, string inord);   // Blog:www.wutianqi.com int main() { while(cin >> preord >> inord) { find_postord(preord, inord); cout << endl; } return 0; }     //找到ch在inord中的位置,未找到返回-1 int find_root(string inord, char ch) { int i; for(i = 0; [...]
            文章來源:http://www.wutianqi.com/?p=285
            posted @ 2010-07-08 18:27 Tanky Woo 閱讀(60) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 很經(jīng)典的遞歸! 把握前序,中序,后序的特點(diǎn)。 前序的第一個(gè)元素是樹的根,在相應(yīng)中序中根以左是左子樹,根以右是右子樹。 注意考慮 n == 1和 n == 0 的情況。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 // POJ 2255 Tree Recovery // Tanky Woo // Memory: 180K Time: 0MS // Language: C++ Result: Accepted   #include <iostream> #include <string> using namespace std;   //定義前序,中序,后序序列 string preord, inord, postord; void find_postord(string preord, string inord);   // Blog:www.wutianqi.com int main() { while(cin >> preord >> inord) { find_postord(preord, inord); cout << endl; } return 0; }     //找到ch在inord中的位置,未找到返回-1 int find_root(string inord, char ch) { int i; for(i = 0; [...]
            文章來源:http://www.wutianqi.com/?p=285
            posted @ 2010-07-08 18:27 Tanky Woo 閱讀(151) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 ?誰說這道題簡單?是水題? 又讓我郁悶了。 思路:枚舉,BFS,位操作 分析:要求輸入一個(gè)4*4的棋盤,考慮狀態(tài)是否全為黑或者全為白,狀態(tài)共有2^16種,聯(lián)系棋盤是4*4,可以想到用位來壓縮狀態(tài)。 bwwb bbwb bwwb bwww 可以表示為:0001|1001|1011|1001 這里對(duì)位操作介紹下: id ^= (1 << i)?? //對(duì)整數(shù)id轉(zhuǎn)換成二進(jìn)制后的第i位取反 其次,這里是廣搜,用隊(duì)列表示。 queue的front(), pop(), push()要掌握。 題目地址: http://acm.pku.edu.cn/JudgeOnline/problem?id=1753 ?Memory:?504K ? ? ?Time:?16MS ? ?Language:?C++ ? ? ?Result:?Accepted 自定義難度:★★★☆☆ 代碼: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 // POJ 1753 // Author: Tanky Woo #include <iostream> #include <queue> using namespace std;   const int MAX_STATE = 65536; const int ALL_BLACK = 65535; const int ALL_WHITE = 0; const int SIZE = 4;   // www.wutianqi.com int convert(char c) { if(c == 'b') return 1; else return 0; }   int FlipPiece(int state_id, int pos) { state_id ^= (1 << pos);   //up if(pos >= 4) state_id [...]
            文章來源:http://www.wutianqi.com/?p=280
            posted @ 2010-07-06 18:37 Tanky Woo 閱讀(1125) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 ?誰說這道題簡單?是水題? 又讓我郁悶了。 思路:枚舉,BFS,位操作 分析:要求輸入一個(gè)4*4的棋盤,考慮狀態(tài)是否全為黑或者全為白,狀態(tài)共有2^16種,聯(lián)系棋盤是4*4,可以想到用位來壓縮狀態(tài)。 bwwb bbwb bwwb bwww 可以表示為:0001|1001|1011|1001 這里對(duì)位操作介紹下: id ^= (1 << i)?? //對(duì)整數(shù)id轉(zhuǎn)換成二進(jìn)制后的第i位取反 其次,這里是廣搜,用隊(duì)列表示。 queue的front(), pop(), push()要掌握。 題目地址: http://acm.pku.edu.cn/JudgeOnline/problem?id=1753 ?Memory:?504K ? ? ?Time:?16MS ? ?Language:?C++ ? ? ?Result:?Accepted 自定義難度:★★★☆☆ 代碼: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 // POJ 1753 // Author: Tanky Woo #include <iostream> #include <queue> using namespace std;   const int MAX_STATE = 65536; const int ALL_BLACK = 65535; const int ALL_WHITE = 0; const int SIZE = 4;   // www.wutianqi.com int convert(char c) { if(c == 'b') return 1; else return 0; }   int FlipPiece(int state_id, int pos) { state_id ^= (1 << pos);   //up if(pos >= 4) state_id [...]
            文章來源:http://www.wutianqi.com/?p=280
            posted @ 2010-07-06 18:37 Tanky Woo 閱讀(112) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 今天論壇的ambition發(fā)了一個(gè)帖子: http://www.cppleyuan.com/redirect.php?tid=1171&goto=lastpost#lastpost 看了下,感覺題目很不錯(cuò),ambition的思路也很好。 涉及到了m^n,我感覺經(jīng)常就是與log一起使用。 把題目做了下,ambition的代碼已經(jīng)足夠了,貼出來分享: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include<iostream> #include<cmath> using namespace std;   int main() { int n,m; double g; double h; for(cin>>n;n>0;n--) { cin>>m; g=m*log10((double)m); [...]
            文章來源:http://www.wutianqi.com/?p=278
            posted @ 2010-07-05 23:17 Tanky Woo 閱讀(141) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 今天論壇的ambition發(fā)了一個(gè)帖子: http://www.cppleyuan.com/redirect.php?tid=1171&goto=lastpost#lastpost 看了下,感覺題目很不錯(cuò),ambition的思路也很好。 涉及到了m^n,我感覺經(jīng)常就是與log一起使用。 把題目做了下,ambition的代碼已經(jīng)足夠了,貼出來分享: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include<iostream> #include<cmath> using namespace std;   int main() { int n,m; double g; double h; for(cin>>n;n>0;n--) { cin>>m; g=m*log10((double)m); [...]
            文章來源:http://www.wutianqi.com/?p=278
            posted @ 2010-07-05 23:17 Tanky Woo 閱讀(128) | 評(píng)論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 就算是第一題又如何,POJ 1000,這是每個(gè)ACM愛好者的第一次。。。。 今天打擊很大,三個(gè)小時(shí)2題都沒做出來,感覺以前做的太混亂了, 今天重新申請了一個(gè)號(hào),開始新的旅程,第一站當(dāng)然就是這一題。 大家可以去看看我的代碼情況,我賬號(hào):200841193 從今天開始系統(tǒng)的開始做了。加油!Tanky Woo! 題目地址: http://acm.pku.edu.cn/JudgeOnline/problem?id=1000 1 2 3 4 5 6 7 8 9 10 11 12 //Author: Tanky Woo #include <iostream>   using namespace std;   int main() { int a,b; cin >> a >> b; cout << a+b << endl; return 0; } 歡迎您來到C++奮斗樂園,原創(chuàng)文章,轉(zhuǎn)載請注明: 轉(zhuǎn)載自Tanky Woo 的程序人生 文章標(biāo)題: POJ 1000 A+B Problem 本文鏈接地址: http://www.wutianqi.com/?p=276
            文章來源:http://www.wutianqi.com/?p=276
            posted @ 2010-07-05 21:14 Tanky Woo 閱讀(197) | 評(píng)論 (1)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網(wǎng)站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 就算是第一題又如何,POJ 1000,這是每個(gè)ACM愛好者的第一次。。。。 今天打擊很大,三個(gè)小時(shí)2題都沒做出來,感覺以前做的太混亂了, 今天重新申請了一個(gè)號(hào),開始新的旅程,第一站當(dāng)然就是這一題。 大家可以去看看我的代碼情況,我賬號(hào):200841193 從今天開始系統(tǒng)的開始做了。加油!Tanky Woo! 題目地址: http://acm.pku.edu.cn/JudgeOnline/problem?id=1000 1 2 3 4 5 6 7 8 9 10 11 12 //Author: Tanky Woo #include <iostream>   using namespace std;   int main() { int a,b; cin >> a >> b; cout << a+b << endl; return 0; } 歡迎您來到C++奮斗樂園,原創(chuàng)文章,轉(zhuǎn)載請注明: 轉(zhuǎn)載自Tanky Woo 的程序人生 文章標(biāo)題: POJ 1000 A+B Problem 本文鏈接地址: http://www.wutianqi.com/?p=276
            文章來源:http://www.wutianqi.com/?p=276
            posted @ 2010-07-05 21:14 Tanky Woo 閱讀(114) | 評(píng)論 (0)編輯 收藏
            僅列出標(biāo)題
            共7頁: 1 2 3 4 5 6 7 
            日本WV一本一道久久香蕉| 99精品久久久久久久婷婷| 日韩欧美亚洲综合久久| 久久久久久久亚洲Av无码| 一级做a爰片久久毛片16| 日本精品久久久久久久久免费| 久久精品无码一区二区WWW| 久久国产精品无码一区二区三区| 亚洲国产精品久久久久婷婷软件| 一级女性全黄久久生活片免费 | 亚洲国产成人久久一区WWW| 国内精品九九久久精品| 91精品国产高清久久久久久91| 伊人色综合久久天天网| 久久久久国产一级毛片高清版| 久久久久久久久久久| 久久精品夜色噜噜亚洲A∨| 久久国产色AV免费看| 午夜人妻久久久久久久久| 手机看片久久高清国产日韩 | 久久A级毛片免费观看| 日韩欧美亚洲国产精品字幕久久久| 国产亚洲欧美成人久久片| 亚洲精品美女久久777777| 香蕉久久夜色精品国产尤物| 精品熟女少妇aⅴ免费久久| 久久99精品国产99久久| 国产情侣久久久久aⅴ免费| 狼狼综合久久久久综合网| 亚洲中文字幕无码久久精品1| 久久中文字幕精品| 综合久久精品色| 2021国内精品久久久久久影院| 久久乐国产精品亚洲综合| 久久毛片免费看一区二区三区| 久久免费国产精品| 亚洲人成网站999久久久综合| 亚洲国产精品无码久久久久久曰| 久久夜色撩人精品国产| 久久婷婷五月综合色奶水99啪| 一本久道久久综合狠狠爱|