题意:求两个串的公共回文子串个数 题解:建两个回文自动机,从0和1各跑一边就是答案了,因为对于回文自动机来说,从头开始dfs就能找出该字符串的所有回文串 //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optimize(4) //#pragma GCC optimize("unroll-loops") //#pragma comment(linker, "/stack:200000000&qu…
The Problem to Slow Down You Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=93645#problem/G Description http://7xjob4.com1.z0.glb.clouddn.com/76e435d3c21fa3cbeef1e76780086dc4 Input   Output Sample In…
The Problem to Slow Down You Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=141572 Mean: 给你两个字符串,求这两个字符串相同回文串的匹配对数. analyse: 每个字符串建一棵回文树,分别从0结点和1结点两棵树一起往下dfs,对于同一条路径上的结点,一定是相同的回文,然后两个的数量相乘加到answer中. Time complexity: O(N)…
The Problem to Slow Down You Time Limit: 20000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGym. Original ID: 100548G64-bit integer IO format: %I64d      Java class name: (Any)   After finishing his homework, our problem setter F…
The Problem to Slow Down You 输入:t个测试样例,每个样例输入两个字符串 输出:这两对字符串的回文串可以组成多少对本质不同的回文串 题意:给你两个字符串,然后问你这两字符串中 有多少对本质不同的字符串子序列 #include<iostream> #include<stdio.h> #include <algorithm> #include <string> #include<string.h> #include<…
https://vjudge.net/problem/UVALive-7041 题意 给出两个仅包含小写字符的字符串 A 和 B : 求:对于 A 中的每个回文子串,B 中和该子串相同的子串个数的总和. 分析 从0和1两个根节点DFS下去,如果两个相同的节点同时存在就统计答案. #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <st…
题目链接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5053 先把第一个串插入回文树中,然后把s数组清空插入第二个串,统计两个cnt数组,答案是二者相乘的结果 #include <iostream> #include <stdlib.h> #include <algorithm> #…
Kevin's Problem 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4921 Description In his applied probability class, Kevin learned about the Secretary Problem. There are N applicants a…
Discrete Logarithm Problem 题目链接: http://acm.hust.edu.cn/vjudge/contest/127401#problem/D Description http://7xjob4.com1.z0.glb.clouddn.com/42600d1bedc3c308a68ea0453befd84e Input The first line of the input file contains a prime p, 1 < p < 2^13 . This…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5919 题意: 给出正整数 $N(1 \le N \le 10^5)$,询问对于正整数 $k$,有多少个小于 $2^N$ 的 $2^k-1$ 是 $7$ 的整数倍. 题解: $…