替换字符串中的子串任务: 给定一个字符串,通过查询一个字符串替换字典,将字符串中被标记的子字符串替换掉。解决方案:>>> import string>>> new_style = string.Template('this is $thing')#给substitute 方法传入一个字典参数并调用....
分类:
编程语言 时间:
2014-09-03 16:26:46
阅读次数:
213
当读者有一定c/c++基础推荐的阅读顺序:level 1从>开始,短小精悍,可以对c++能进一步了解其特性以>作字典和课外读物,因为太厚不可能一口气看完level 2然后从>开始转职,这是圣经,请遵守10诫,要经常看,没事就拿来翻翻接着是>,个人认为Herb Sutter主席大人的语言表达能力不及S...
分类:
编程语言 时间:
2014-09-03 14:33:36
阅读次数:
234
所谓关联数组(associative array), 就是指javascript中的对象。因为javascript中的属性就是一个个的键值对,可以通过obj[attr]的方式访问,很类似数组。这种数据结构还有很多种叫法:散列(hash)散列表(hashtable)字典(dictionary)最让人感...
分类:
编程语言 时间:
2014-09-03 12:57:46
阅读次数:
201
题目摘自http://blog.csdn.net/dongyi91/article/details/38639915 写了2个小时,水平太菜了入法的编码原理为:根据已有编码表,当输入拼音和数字后输出对应的字符。例如:有如下编码:喜_xi 洗_xi 系_xi 无_wu 五_wu(字符和拼音...
分类:
编程语言 时间:
2014-09-03 12:34:26
阅读次数:
194
HDU 1247 Hat’s Words(字典树变形)...
分类:
其他好文 时间:
2014-09-03 09:42:06
阅读次数:
177
=================================================EmployeeID.cs(学生编号类)usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespaceConsoleApplication7
{
//作为键的类型必须要重写GetHashCode()
p..
分类:
其他好文 时间:
2014-09-03 02:44:16
阅读次数:
237
------------------------------------------------------------------------------Person.csusingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespaceConsoleApplication1
{
publicclassPerson
{
publicst..
分类:
其他好文 时间:
2014-09-03 02:43:16
阅读次数:
159
--------------------------------------------------------------EmployeeID.cs(键)usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingSystem.Collections;
publicclassEmployeeID:IComparable<Emp..
分类:
其他好文 时间:
2014-09-03 02:42:16
阅读次数:
179
UVA 10537 - The Toll! Revisited
题目链接
题意:给定一个无向图,大写字母是城市,小写字母是村庄,经过城市交过路费为当前货物的%5,路过村庄固定交1,给定起点终点和到目标地点要剩下的货物,问最少要带多少货物上路,并输出路径,如果有多种方案,要求字典序最小
思路:dijstra的逆向运用,d数组含义变成到该结点至少需要这么多货物,然后反向建图,从终点向...
分类:
Web程序 时间:
2014-09-03 00:20:55
阅读次数:
383
题目连接:uva 1556 - Disk Tree
题目大意:给出N个目录关系,然后按照字典序输出整个文件目录。
解题思路:以每个目录名作为字符建立一个字典树即可,每个节点的关系可以用map优化。
#include
#include
#include
#include
#include
#include
using namespace std;
const int ma...
分类:
其他好文 时间:
2014-09-02 22:54:35
阅读次数:
248