ICode9

精准搜索请尝试: 精确搜索
  • Codeforces Round #721 (Div. 2)A. And Then There Were K(位运算,二进制) B1. Palindrome Game (easy version2021-05-22 21:03:28

    半个月没看cf 手生了很多(手动大哭)     Problem - A - Codeforces 题意 给定数字n, 求出最大数字k, 使得  n & (n−1) & (n−2) & (n−3) & ... (k) = 0 题解 &:有0则0 假如n转为二进制共有x位 , 要使&后=0, k的最高位需=0 我们使最高位=0,后面都为1; 那么此数+1=什么 =100

  • POJ 3280 Cheapest Palindrome(区间dp)2021-05-22 11:34:24

    POJ 3280 Cheapest Palindrome(区间dp) 此题为取两端的区间dp。 分情况讨论: 1. a i = a

  • 906. Super Palindromes2021-05-09 05:01:15

    Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome. Given two positive integers left and right represented as strings, return the number of super-palindromes integers in the inclusive r

  • 直接进入进阶场-palindrome-number(回文数)2021-04-29 20:59:14

    【开篇语】你能不将整数转为字符串来解决这个问题吗? 【leetcode-9】https://leetcode-cn.com/problems/palindrome-number/ 【题目】 给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。 回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回

  • ural1297 palindrome2021-04-27 20:04:42

    【题意】 求最长回文子串 【分析】 把原字符串翻过来接到后面,中间放一个特殊字符 然后枚举每一个点作为回文串的中心,计算当前位置的后缀和对应的延长位置上的后缀的最长公共前缀 具体的:分类讨论如果i为奇数长度的中心lcp(i,n-i-1),i为偶数长度回文串的中心的一个lcp(i,n-i)   【代

  • codeforces A-B Palindrome2021-04-23 15:30:18

    题目链接: (https://codeforces.com/contest/1512/problem/C) 思路: 1.遍历字符串,将可以确定的‘?’给确定了,处理完之后剩下的‘?’必然对称 2.遍历字符串,每当遇到‘?’,可以用的1比较多那就换成1,否则换成0,时刻需要注意是否不符合题意,若不符合题意,直接输出-1 1A代码(还可以精简) #in

  • 【Leetcode】125. 验证回文串(Valid Palindrome)2021-04-04 12:33:55

    一、题目 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 二、示例 示例 1: 输入: “A man, a plan, a canal: Panama” 输出: true 示例 2: 输入: “race a car” 输出: false 说明: 本题中,我们将空字符串定义为有效的回文串。 三、解法 解法1

  • AtCoder Beginner Contest 197 F - Construct a Palindrome2021-03-31 21:32:02

    https://atcoder.jp/contests/abc197/tasks/abc197_f 过了一车人的套路我不会。。。 把题目转化成二维平面的模型,dis[u][v]表示从1到u,从n到v,一直走相同字母的距离 然后我们枚举每个点u:{s,e}的所有边,得到u:{s,e}->v:{s.v,e.v}这样的边,且他们走是相同的字母,这样枚举最大是m^2的

  • uva11475 - Extend to Palindrome2021-03-25 20:58:37

    链接 题面: 11475 - Extend to Palindrome 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

  • 【leetcode】132. 分割回文串 II(palindrome-partitioning-ii)(DP)[困难]2021-03-08 11:59:58

    链接 https://leetcode-cn.com/problems/palindrome-partitioning-ii/ 耗时 解题:32 min 题解:25 min 题意 给你一个字符串 s,请你将 s 分割成一些子串,使每个子串都是回文。 返回符合要求的 最少分割次数 。 思路 dp[i] 表示 s[0:i] 的字符串的最少分割次数。

  • 【LeetCode】131. 分割回文串 Palindrome Partitioning(C++)2021-03-07 13:57:59

    目录 题目描述题目大意回溯法+动态规划复杂度分析 题目来源:https://leetcode-cn.com/problems/next-greater-element-ii/ 题目描述 给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串。 返回 s 所有可能的分割方案。 输入: “aab” 输出: [ [“aa”,“b”], [

  • 131. Palindrome Partitioning(Leetcode每日一题-2021.03.07)2021-03-07 09:58:37

    Problem Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. A palindrome string is a string that reads the same backward as forward. Constraints: 1 <= s.length <

  • Palindrome-(Manacher算法)2021-03-05 17:59:17

    题目链接:点击进入 题目 题意 给定一个字符串,求最长回文子串。 思路 Manacher算法模板 代码 #include<iostream> #include<string> #include<map> //#include<unordered_map> #include<queue> #include<cstdio> #include<vector> #include<cstring> #include&

  • 力扣 5. 最长回文子串(中等)2021-03-03 13:01:00

    题目 给你一个字符串 s,找到 s 中最长的回文子串。 题解 核⼼思想是:对于字符串中每个字符都从中间开始向两边扩散来判断回⽂串。 传入两个指针 i 和 j,实现同时处理回⽂串长度为奇数和偶数的情况。 class Solution { public String longestPalindrome(String s) {

  • CF932G-Palindrome Partition【PAM】2021-03-01 17:03:35

    正题 题目链接:https://www.luogu.com.cn/problem/CF932G 题目大意 给出一个长度为\(n\)的字符串,将其分为\(k\)段(\(k\)为任意偶数),记为\(p\)。要求满足对于任意\(i\)都有\(p_i=p_{k-i+1}\)。求方案数。 \(1\leq n\leq 10^6\) 解题思路 考虑将字符串化为\(S_1S_nS_2S_{n-1}S_3S_{n

  • CSCI 1512021-02-28 20:02:09

    CSCI 151: Programming for Scientists and EngineersProgramming Assignment IDeadline: 26 February 2021, 8:00pm1. In this task, you are required to write a program that evaluates the scores of two playersin the Tic-Tac-Toe game, .Your program will perform th

  • 1745. Palindrome Partitioning IV (回文树)2021-02-15 12:01:43

    题目 题意:判断一个字符串是否可以由三个回文串组成 题解:利用强大的回文树,计算出以每个字符为结尾的回文串,然后从字符串的最后一个字符开始,递归判断。 struct Tree { int next[4005][30]; int fail[4005]; int cnt[4005]; int num[4005]; int len[4005]; int s[4005]; int p

  • LeetCode 9.Palindrome Number(回文数) 数学/easy2021-02-10 18:04:30

    文章目录 1.Description2.Example3.Solution 1.Description 给你一个整数 x ,如果 x 是一个回文整数,返回 ture ;否则,返回 false 。 回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回文,而 123 不是。 2.Example 示例 1: 输入:x = 121 输出:true 示例 2:

  • [String][3]Leetcode125. Valid Palindrome2021-01-30 23:57:42

    125. Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a

  • poj1159 Palindrome2021-01-25 19:03:28

    Palindrome poj1159 题目 Problem Description 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 c

  • CodeForces - 932G Palindrome Partition2021-01-13 23:34:29

    \(\text{Description}\) 传送门 \(\text{Solution}\) 有一个很强的转化:考虑构造 \(s'=s[1]s[n]s[2]s[n-1]...s[\frac{n}{2}]s[\frac{n}{2}+1]\)。具体就感性理解吧:由于题目要求 \(s_1=s_k,s_2=s_{k-1}...\),可以知道分段后一定是对称的,所以反转就是要求 \(s’\) 的回文串分割次数(注

  • 131. Palindrome Partitioning2021-01-09 09:35:25

    问题: 给定一个字符串,进行切分,使得每个切片都是一个回文字符串。将所有切法返回。 Example 1: Input: s = "aab" Output: [["a","a","b"],["aa","b"]] Example 2: Input: s = "a" Output: [["a"]] Constraints: 1 <= s.l

  • hdu 6599 I Love Palindrome String (回文树 + 哈希/manacher)2020-12-24 13:04:25

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6599 利用回文树找出所有的回文串(记录出现的位置) 然后利用哈希判断回文串的一半是否也是回文串即可 #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<cmath> using namespace std; typ

  • E2. Three Blocks Palindrome (hard version)2020-12-19 11:57:53

    文章目录 [E2. Three Blocks Palindrome (hard version)](https://codeforces.com/contest/1335/problem/E2)题目大意解题思路代码 E2. Three Blocks Palindrome (hard version) 题目大意 给你一个长度为 n 的数列,让你选取一种子序列,这种子序列最多有两种元素构成并且左

  • Leetcode 234. Palindrome Linked List2020-12-01 16:02:25

    Description: Given a singly linked list, determine if it is a palindrome. Link: https://leetcode.com/problems/palindrome-linked-list/ Examples: Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Example 3: Input:

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

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

ICode9版权所有