2013年4月16日

Trie 模板

摘要: //用类,或者结构体定义都行 class trie { public: trie* next[26]; int num; int value; trie() { for(int i=0;i<26;i++) next[i]=0; value=0;//记录是不是一个单词 num=0;//记录单词出现的次数 } }root; //插入: void insert(trie* p,char* s) { p=&root; int k=0; while(s[k]!='\0') ... 阅读全文

posted @ 2013-04-16 20:49 电子幼体 阅读(140) 评论(0) 推荐(0) 编辑

POJ 2449 Remmarguts' Date k短路

摘要: Remmarguts' DateTime Limit:4000MSMemory Limit:65536KTotal Submissions:17094Accepted:4694Description"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story."Prince Remmarguts lives i 阅读全文

posted @ 2013-04-16 18:23 电子幼体 阅读(153) 评论(0) 推荐(0) 编辑

二分查找法的实现和应用汇总

摘要: 在学习算法的过程中,我们除了要了解某个算法的基本原理、实现方式,更重要的一个环节是利用big-O理论来分析算法的复杂度。在时间复杂度和空间复杂度之间,我们又会更注重时间复杂度。时间复杂度按优劣排差不多集中在:O(1), O(log n), O(n), O(n log n), O(n2), O(nk), O(2n)到目前位置,似乎我学到的算法中,时间复杂度是O(log n),好像就数二分查找法,其他的诸如排序算法都是 O(n log n)或者O(n2)。但是也正是因为有二分的 O(log n), 才让很多 O(n2)缩减到只要O(n log n)。关于二分查找法二分查找法主要是解决在“一堆数中找 阅读全文

posted @ 2013-04-16 15:43 电子幼体 阅读(157) 评论(0) 推荐(0) 编辑

省赛练习2 Doctor NiGONiGO’s multi-core CPU 最大费用最大流

摘要: Doctor NiGONiGO’s multi-core CPUTime Limit 2000msMemory Limit 65536KdescriptionDoctor NiGONiGO has developed a new kind of multi-core CPU, it works as follow. There are q (1 < q ≤ 50) identical cores in the CPU, and there are p (0 < p ≤ 200) jobs need to be done. Each job should run in some co 阅读全文

posted @ 2013-04-16 15:26 电子幼体 阅读(195) 评论(0) 推荐(0) 编辑

导航