上一页 1 2 3 4 5 6 7 8 ··· 17 下一页
题目用map写超便捷也可以用字典树来写我以前是用map的:#include#include#include#include#include#include #includeusing namespace std;string word[50010];int main(){ int i=0,n,... Read More
posted @ 2014-08-13 11:12 laiba2004 Views(120) Comments(0) Diggs(0) Edit
题目字典树,注意初始化的位置~!!位置放错,永远也到不了终点了org。。。。我是用数组模拟的字典树,这就要注意内存开多少了,,要开的不大不小刚刚好真的不容易啊。。。。我用了val来标记是否是同一个串分解而来的,保存的是串的编号num记录数目。//string &replace(iterator fi... Read More
posted @ 2014-08-13 10:54 laiba2004 Views(130) Comments(0) Diggs(0) Edit
题目参考自博客:http://blog.csdn.net/a601025382s/article/details/38517783//string &replace(iterator first0, iterator last0,const_iterator first, const_iterato... Read More
posted @ 2014-08-12 20:33 laiba2004 Views(173) Comments(0) Diggs(0) Edit
题目参考自博客:http://blog.csdn.net/keshuai19940722/article/details/38455269//字典树,博弈根据当前节点的后续来确定当前节点的状态,0是由对手决定,1是只有可能输,2是只有可能赢,3是可以决定自己的胜负。这些状态是要综合所有后续情况确定的... Read More
posted @ 2014-08-12 08:55 laiba2004 Views(179) Comments(0) Diggs(0) Edit
题目//居然可以用字典树。。。//用cin,cout等输入输出会超时//这是从别处复制来的#include#include#includeusing namespace std;int node[3011111][2];int tag,m,n,cas=0,T;long long one[64],al... Read More
posted @ 2014-08-11 16:11 laiba2004 Views(325) Comments(0) Diggs(0) Edit
题目又来了string的基本用法//less than 30 digits//等级长度甚至是超过了int64,所以要用字符串来模拟,然后注意去掉前导零//最多重复的个数就是答案//关于string的修改增加的用法#include #include#include #include #includeu... Read More
posted @ 2014-08-06 14:08 laiba2004 Views(96) Comments(0) Diggs(0) Edit
题目这要学习的是如何枚举区间,vector的基本使用(存入,取出,排序等),这题的思路来自:http://www.tuicool.com/articles/fAveE3//vector 可以用sort排序:sort(ve.begin(),ve.end());//下标从0开始,内部元素可以用vec[i... Read More
posted @ 2014-08-06 13:20 laiba2004 Views(150) Comments(0) Diggs(0) Edit
题目给出一个n*m的01矩阵, 让你最多改变k个里面的值(0变1,1变0), 使得0、1的连通分量是矩阵。输出最少步数1 ≤ n, m ≤ 100;1 ≤ k ≤ 10题解:如果01连通分量是矩形,那么矩形一定是这样的:0101010101010101010101010101(上面的01代表子矩阵块... Read More
posted @ 2014-08-06 13:05 laiba2004 Views(313) Comments(0) Diggs(0) Edit
题目字符串处理题意要猜,解析见代码:/*这题每个S(n)是描述S(n-1)值例如:S(1)=1;S(2)=11;即描述S(1)有1个1=11S(3)=21;即描述S(2)有2个1=21S(4)=1211;即描述S(3)有1个2和2个1=1211....*/#include #include#incl... Read More
posted @ 2014-08-05 20:23 laiba2004 Views(170) Comments(0) Diggs(0) Edit
题目//参考了网上的代码注意答案可能超过32位//要达成目标,就是要所有数列a的都比数列b的要小或者等于//然后,要使最小的要和最大的一样大,就要移动(大-小)步,//要使较小的要和较大的一样大,也是要移动(较大-较小)步//然后都加在一起就好了#include#include#include#in... Read More
posted @ 2014-08-04 18:39 laiba2004 Views(116) Comments(0) Diggs(0) Edit
上一页 1 2 3 4 5 6 7 8 ··· 17 下一页