ICode9

精准搜索请尝试: 精确搜索
  • Palindrome Partition CodeForces - 932G 回文树+DP+(回文后缀的等差性质)2019-08-24 11:02:31

    题意: 给出一个长度为偶数的字符串S,要求把S分成k部分,其中k为任意偶数,设为a[1..k],且满足对于任意的i,有a[i]=a[k-i+1]。问划分的方案数。 n<=1000000   题解: 反正我是不会做   (我是转载的yyb博客,巨佬写的超级超级详细)基本就是照着laofulaofu的打了一遍(laofu太强啦) 这题分成了两个

  • I Love Palindrome String HDU - 6599 回文树+hash2019-08-24 09:51:28

    题意: 输出每个长度下的回文串(这些回文串的左半边也需要是回文串) 题解: 直接套上回文树,然后每找到一个回文串就将他hash。 因为符合要求的回文串本身是回文串,左半边也是回文串,所以它左半边也右半边相同, 自己画个图很容易发现的   每次hash判断一下就好了   1 #include <set>

  • 2019杭电多校二 I Love Palindrome String(回文自动机)2019-08-20 11:01:04

    题意 给定一个串,求各长度下,本质不同的回文串并且回文串的左右两个字串也是回文串的数量。 传送门 思路 题意比较绕,理顺下来就是在回文树的每个节点,求其节点对应回文串的一半是否也是回文串,如果是,则其对该节点的长度产生贡献, 判断其回文串的一半是否也为回文串可以用马拉车或者哈希

  • LeetCode 234 Palindrome Linked List2019-08-12 12:52:00

      要点理解 : 回文串是中心对称的   /** * @Description 链表类需要自定义 * @Date 2019/8/11 17:40 **/class ListNode{ int val; ListNode next; public ListNode(int x){ val=x; }}/** * @Description * @Date 2019/8/11 17:40 **/public class Palindrom

  • LightOJ - Making Huge Palindromes(KMP&回文)2019-08-12 09:43:20

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1258Time Limit: 1 second(s) Memory Limit: 32 MB Problem Description A string is said to be a palindrome if it remains same when read backwards. So, 'abba', 'madam' both are palindr

  • 判断回文字符串2019-08-06 20:50:30

    判断回文字符串 本题要求编写函数,判断给定的一串字符是否为“回文”。所谓“回文”是指顺读和倒读都一样的字符串。如“XYZYX”和“xyzzyx”都是回文。 函数接口定义: bool palindrome( char *s ); 函数palindrome判断输入字符串char *s是否为回文。若是则返回true,否则返回false。

  • Leetcode-5150 Longest Chunked Palindrome Decomposition(段式回文)2019-08-04 13:02:08

    1 #define _for(i,a,b) for(int i = (a);i < b;i ++) 2 3 bool judge(string s,int i,int j,int len) 4 { 5 _for(k,0,len) 6 if(s[i]!=s[j]) 7 return false; 8 else 9 i ++,j ++;10 return true;11 }12 class Solutio

  • 杭电多校第二场——I Love Palindrome String(回文树+字符串hash)2019-07-28 22:04:33

    http://acm.hdu.edu.cn/showproblem.php?pid=6599 题目描述: 给你一个串,求这个串有多少个本质不同的回文串,并且这些回文串的一半也是回文串。 思路: 这题让我系统了解了一下回文树的操作和功能 求串S前缀0~i内本质不同回文串的个数(两个串长度不同或者长度相同且至少有一个字符不

  • c – 检查数字是否为回文2019-07-28 21:16:27

    我试着通过以下代码检查数字是否是回文: unsigned short digitsof (unsigned int x) { unsigned short n = 0; while (x) { x /= 10; n++; } return n; } bool ispalindrome (unsigned int x) { unsigned short digits = digitsof (x);

  • T - Palindrome(manacher+树状数组)2019-07-28 20:38:56

    题目 Alice like strings, especially long strings. For each string, she has a special evaluation system to judge how elegant the string is. She defines that a string S[1. .3n−2 ] (n≥2) is one-and-half palindromic if and only if it satisfies S[i]=S[2n−

  • I Love Palindrome String2019-07-27 10:54:50

     I Love Palindrome String 时间限制: 2 Sec  内存限制: 128 MB 题目描述 You are given a string S=s1s2..s|S| containing only lowercase English letters. For each integer i∈[1,|S|] , please output how many substrings slsl+1...srsatisfy the following conditio

  • Palindrome2019-07-25 11:00:29

    POJ 给定一个字符串,求其最长回文子串的长度. 分析:马拉车算法模板题. //#include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; inline int read(){ int x=0,o=1;char ch=g

  • 2019 Multi-University Training Contest 22019-07-24 19:00:24

    A. Another Chess Problem B. Beauty Of Unimodal Sequence C. Coefficient D. Double Tree E. Everything Is Generated In Equal Probability F. Fantastic Magic Cube G. Game H. Harmonious Army I. I Love Palindrome String J. Just Skip The Problem K. Keen

  • Manacher算法 & Palindrome2019-07-24 09:01:06

    马拉车用于解决最长回文子串问题,重点是子串,而不是子序列,时间复杂度为O(n)。 解释一下变量的意义: Len[i]数组去存第i个位置到mx位置的长度 id记录上一次操作的位置(这个操作可以看模板) mx标记上一次的最长子串的最右端   模板: 1 void init() //这个是用来处理字符串的 2 { 3

  • Palindrome POJ-11592019-07-21 14:42:30

    A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal number of characters to be inserted into the string in or

  • [USACO07OPEN]便宜的回文Cheapest Palindrome2019-07-18 17:57:10

    题目链接 题目概要:对于用字典序中前n个小写字母组成的串,付出一定的代价来插入or删除使其成为回文串的最小代价。 解题思路:首先对于最优解,要么是贪心要么是DP。这题是DP。设f[i][i+l]为将a[i]~a[i+l]变成回文的最小代价。方程式: ①若a[i]==a[i+l] f[i][i+l]=f[i+1][i+l-1] ②s1=f[i]

  • LeetCode - 125. Valid Palindrome2019-07-17 19:42:22

    题目 LeetCode - 125. Valid Palindrome 题目链接 https://leetcode.com/problems/valid-palindrome/ 参考博客 解题思路 简单题。 解题源码 class Solution { public: bool isPalindrome(string s) { string ans, ans2; for(auto t : s){

  • UVA - 11475 Extend to Palindrome (后缀数组)2019-07-13 21:00:07

    Your task is, given an integer N, to make a palidrome (word that reads the same when you reverse it) of length at least N. Any palindrome will do. Easy, isn’t it? That’s what you thought before you passed it on to your inexperienced team-mate. When the co

  • 131. Palindrome Partitioning2019-07-11 16:42:37

    Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: Input: "aab" Output: [ ["aa","b"], ["a","a","b

  • leetcode 575:Distribute Candies, 266: Palindrome Permutation, 46:Permutations2019-07-04 19:54:51

    思路:给我们一堆糖,每种糖的个数不定,分给两个人,让我们求其中一个人能拿到的最大的糖的种类数。那么我们想,如果总共有n个糖,平均分给两个人,每人得到n/2块糖,那么能拿到的最大的糖的种类数也就是n/2种,不可能再多,只可能再少。那么我们要做的就是统计出总共的糖的种类数,如果糖的种类数小于n

  • poj 2402 Palindrome Numbers 数字回文 (★★☆☆☆)2019-06-28 12:50:09

    http://poj.org/problem?id=2402 题意:求从1开始的第i(1<= i <= 2*10^9)个数字回文。 由于给出的测试数据范围太大,暴力搜索不得不丢弃。在网上找了两篇解题报告,看了好一会,才完全弄明白。 解题方案: (1)先求出第i个数字回文的位数k,当位数为k时,k位数字组成的回文数为        f(k

  • hdu 三部曲 Cheapest Palindrome2019-06-26 12:49:02

    Problem Description Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system will read as the cows pass by a scanner. Each ID tag's con

  • 【LeetCode】9、Palindrome Number(回文数)2019-06-23 12:51:06

    题目等级:Easy 题目描述: Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. F

  • 实验吧之【你真的会PHP吗?】2019-06-23 08:52:35

    你真的会PHP吗? 首先刚进网页就是一个have fun  看了源码没有什么提示,也没有输入框,那就打开F12看看   有提示 6c525af4059b4fe7d8c33a.txt 访问 http://ctf5.shiyanbar.com/web/PHP/6c525af4059b4fe7d8c33a.txt   原来是审计   <?php$info = ""; $req = [];$flag="xxxxxxxx

  • Palindrome Partitioning2019-06-22 12:51:39

    Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example:Input: "aab"Output:[ ["aa","b"], ["a","a","b&qu

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有