摘要: Manacher 算法: 用于找一个长串中的最长回文串。 思路是把奇数或偶数的字符串都转换成奇数的字符串然后处理。 遍历,记录每一次能到达的最右和这个中心轴,利用一个数组记录中心点到最右端的距离。每次更新它的值和这个中心轴。 1.3.3 Calf Flac Description 据说如果你给无限只 阅读全文
posted @ 2018-09-17 20:13 我的秘密小屋 阅读(207) 评论(0) 推荐(0)
摘要: 求n的n此方的最后一位: 求n的n此方的最高位: 求n的介乘的有多少个零: 思路: 0的来源是5×2,1--n中的数如果能被2整除或被5整除 ,就可以看作2或5,而2是每两个就会有一个2,5则是每5个才有一个5,所以2的个数比5的多,求零的个数只需求5的个数即可。 所以看 1遍历到n ,每个数能分成 阅读全文
posted @ 2018-09-04 19:49 我的秘密小屋 阅读(178) 评论(1) 推荐(0)
摘要: 1 头文件 #include<vector> 2 定义 vector<int>vec; //定义一个int型向量 向量的意思就是一开始没有长度限制 vector<int>vec(10); //初始大小为10,这样就可以用数组的方式访问或者修改里面的值了。 vector<int>vec(10,1); 阅读全文
posted @ 2018-08-24 13:04 我的秘密小屋 阅读(144) 评论(0) 推荐(0)
摘要: string基操: #include<string> string a; cin>>a; 长度的获取: a.size(); 获得第一个字符: string:const_iterator it=s.begin(); count<<*it<<endl; 获得最后一个字符: string:const_it 阅读全文
posted @ 2018-08-24 11:17 我的秘密小屋 阅读(156) 评论(0) 推荐(0)
摘要: 1267 4个数和为0 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 收藏 关注 1267 4个数和为0 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 1267 4个数和为0 基准时间限制:1 秒 空间限制:131072 K 阅读全文
posted @ 2018-08-22 21:06 我的秘密小屋 阅读(407) 评论(0) 推荐(0)
摘要: http://acm.sdibt.edu.cn/vjudge/contest/view.action?cid=1977#problem/A 广搜: e2 e4a1 b2b2 c3a1 h8a1 h7h8 a1b1 c3f6 f6 在一个8*8的棋盘中,a1代表第零行的第一个元素,每个棋子只能像象棋中 阅读全文
posted @ 2018-08-18 18:19 我的秘密小屋 阅读(210) 评论(1) 推荐(0)
摘要: POJ 3061: For each the case the program has to print the result on separate line of the output file.if no answer, print 0. Sample Input Sample Output 阅读全文
posted @ 2018-08-15 18:14 我的秘密小屋 阅读(285) 评论(0) 推荐(0)
摘要: 三大博弈(+斐波那契博弈) 巴什博弈: 只有一堆n个物品,两个人轮流从这堆物品中取物, 规定每次至少取一个,最多取m个。最后取光者得胜。如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜。 只要保持给对手留下(m+1)的倍数,就能最后获胜 阅读全文
posted @ 2018-08-15 16:09 我的秘密小屋 阅读(179) 评论(0) 推荐(0)
摘要: You have a fraction . You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point. The first contains t 阅读全文
posted @ 2018-08-14 14:28 我的秘密小屋 阅读(418) 评论(0) 推荐(0)
摘要: Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positiv 阅读全文
posted @ 2018-08-11 08:38 我的秘密小屋 阅读(235) 评论(0) 推荐(0)