• <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

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

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            搜索

            •  

            積分與排名

            • 積分 - 179082
            • 排名 - 147

            最新評論

            閱讀排行榜

            評論排行榜

            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 經典的遞歸問題,遞歸+回溯解決。 注意代碼中select_combination()的應用 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)//遞歸填充數并打   印組合,相當于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 閱讀(146) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 經典的遞歸問題,遞歸+回溯解決。 注意代碼中select_combination()的應用 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)//遞歸填充數并打   印組合,相當于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 閱讀(84) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 很經典的遞歸! 把握前序,中序,后序的特點。 前序的第一個元素是樹的根,在相應中序中根以左是左子樹,根以右是右子樹。 注意考慮 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 閱讀(59) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 很經典的遞歸! 把握前序,中序,后序的特點。 前序的第一個元素是樹的根,在相應中序中根以左是左子樹,根以右是右子樹。 注意考慮 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 閱讀(150) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 ?誰說這道題簡單?是水題? 又讓我郁悶了。 思路:枚舉,BFS,位操作 分析:要求輸入一個4*4的棋盤,考慮狀態是否全為黑或者全為白,狀態共有2^16種,聯系棋盤是4*4,可以想到用位來壓縮狀態。 bwwb bbwb bwwb bwww 可以表示為:0001|1001|1011|1001 這里對位操作介紹下: id ^= (1 << i)?? //對整數id轉換成二進制后的第i位取反 其次,這里是廣搜,用隊列表示。 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) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 ?誰說這道題簡單?是水題? 又讓我郁悶了。 思路:枚舉,BFS,位操作 分析:要求輸入一個4*4的棋盤,考慮狀態是否全為黑或者全為白,狀態共有2^16種,聯系棋盤是4*4,可以想到用位來壓縮狀態。 bwwb bbwb bwwb bwww 可以表示為:0001|1001|1011|1001 這里對位操作介紹下: id ^= (1 << i)?? //對整數id轉換成二進制后的第i位取反 其次,這里是廣搜,用隊列表示。 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) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 今天論壇的ambition發了一個帖子: http://www.cppleyuan.com/redirect.php?tid=1171&goto=lastpost#lastpost 看了下,感覺題目很不錯,ambition的思路也很好。 涉及到了m^n,我感覺經常就是與log一起使用。 把題目做了下,ambition的代碼已經足夠了,貼出來分享: 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 閱讀(137) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 今天論壇的ambition發了一個帖子: http://www.cppleyuan.com/redirect.php?tid=1171&goto=lastpost#lastpost 看了下,感覺題目很不錯,ambition的思路也很好。 涉及到了m^n,我感覺經常就是與log一起使用。 把題目做了下,ambition的代碼已經足夠了,貼出來分享: 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 閱讀(127) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 就算是第一題又如何,POJ 1000,這是每個ACM愛好者的第一次。。。。 今天打擊很大,三個小時2題都沒做出來,感覺以前做的太混亂了, 今天重新申請了一個號,開始新的旅程,第一站當然就是這一題。 大家可以去看看我的代碼情況,我賬號:200841193 從今天開始系統的開始做了。加油!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++奮斗樂園,原創文章,轉載請注明: 轉載自Tanky Woo 的程序人生 文章標題: 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) | 評論 (0)編輯 收藏
            歡迎您來到Tanky Woo的博客: 我們的【C++奮斗樂園】 C++/算法網站:www.cpply.com C++/算法論壇:www.cppleyuan.com QQ群:①群:19333724 ②群:23840480 ③群:17314377 ④群:23829384 就算是第一題又如何,POJ 1000,這是每個ACM愛好者的第一次。。。。 今天打擊很大,三個小時2題都沒做出來,感覺以前做的太混亂了, 今天重新申請了一個號,開始新的旅程,第一站當然就是這一題。 大家可以去看看我的代碼情況,我賬號:200841193 從今天開始系統的開始做了。加油!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++奮斗樂園,原創文章,轉載請注明: 轉載自Tanky Woo 的程序人生 文章標題: 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 閱讀(195) | 評論 (1)編輯 收藏
            僅列出標題
            共7頁: 1 2 3 4 5 6 7 
            91精品国产91久久久久久蜜臀| 日本精品久久久中文字幕| 久久亚洲精品无码观看不卡| 久久AV无码精品人妻糸列| 久久AV高清无码| 久久久久亚洲精品中文字幕| 久久天天躁狠狠躁夜夜96流白浆| 久久国产精品99久久久久久老狼| 午夜精品久久影院蜜桃| 91精品国产高清久久久久久io| 久久久久久久亚洲精品| 国产亚洲精品美女久久久| 无码8090精品久久一区| 97久久精品无码一区二区天美| 亚洲国产成人乱码精品女人久久久不卡| 东方aⅴ免费观看久久av| 99久久婷婷国产综合精品草原| 奇米影视7777久久精品| 久久久久亚洲精品无码网址| 青青草原综合久久| 国内精品久久久久影院免费| 狠狠色丁香久久婷婷综合_中| 久久精品国产一区二区| 成人精品一区二区久久| 国内精品久久久久久久97牛牛| 久久久久久久久久久久久久| 久久久久99精品成人片牛牛影视| 91精品国产高清久久久久久io| 亚洲va久久久噜噜噜久久狠狠| 亚洲综合久久夜AV | 99久久精品费精品国产| 亚洲国产成人久久综合一| AV狠狠色丁香婷婷综合久久| 久久亚洲私人国产精品| 无码专区久久综合久中文字幕| 一本色道久久综合亚洲精品| 亚洲欧美日韩中文久久| 色婷婷综合久久久久中文| 综合久久国产九一剧情麻豆| 亚洲AV无码久久精品狠狠爱浪潮| 亚洲色欲久久久综合网东京热|