codeforces 464C. Substitutes in Number】的更多相关文章

题目链接 C. Substitutes in Number time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew…
题目链接: http://codeforces.com/contest/464/problem/C J. Substitutes in Number time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends A…
http://codeforces.com/contest/465/problem/E 给定一个字符串,以及n个变换操作,将一个数字变成一个字符串,可能为空串,然后最后将字符串当成一个数,取模1e9+7. 逆向操作,维护每次替换后产生的数值和长度 替换P - > d_1d_2--d_n后 新的P的长度Len[ d_1 ] +--+ Len [ d_n ] 新的P值是Val[ d_n ] + 10 ^(Len [ d_n ])* Val [ d_(n-1)] + 10 ^(Len [ d_n ]…
Queries for Number of Palindromes Problem's Link:   http://codeforces.com/problemset/problem/245/H Mean: 给你一个字符串,然后q个询问:从i到j这段字符串中存在多少个回文串. analyse: dp[i][j]表示i~j这段的回文串数. 首先判断i~j是否为回文,是则dp[i][j]=1,否则dp[i][j]=0; 那么dp[i][j]=dp[i][j]+dp[i][j-1]+dp[i+1[j…
D. Number of Parallelograms 题目连接: http://www.codeforces.com/contest/660/problem/D Description You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertice…
\(>Codeforces \space 980 E. The Number Games<\) 题目大意 : 有一棵点数为 \(n\) 的数,第 \(i\) 个点的点权是 \(2^i\) 你需要删掉 \(k\) 个点,使得删掉这些点后树依然联通,且剩下的点权之和最大,并输出方案 \(n , k \leq 10^6\) 解题思路 : 问题可以转化为选取 \(n - k\) 个点,使得选取的点联通且权值和最大 根据点权是 \(2^i\) 的性质,显然有选取编号为 \(x\) 的点比选取 \(i =…
G. Xor-matic Number of the Graph http://codeforces.com/problemset/problem/724/G 题意:给你一张无向图.定义一个无序三元组(u,v,s)表示u到v的(不一定为简单路径)路径上xor值为s.求出这张无向图所有不重复三元组的s之和.1≤n≤10^5,1≤m≤2*10^5. 想法: 如果做过[Wc2011 xor]这道题目(题解),那么问题变得简单起来了. ①假设我们钦定一个(u,v),设任意一条u->v的路径xor值为X,…
[题目链接]:http://codeforces.com/contest/805/problem/D [题意] 给你一个字符串; 里面只包括a和b; 让你把里面的"ab"子串全都去掉; 方式是, 每次操作可以把"ab"替换成为"bba"; 直到整个字符串里面没有"ab"子串为止 [题解] 从ab开始 ab->bba 左边再加一个a的话 即aab 就相当于在bba左边加了一个a abba -> bbaba bbbba…
题目描述: time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Dima worked all day and wrote down on a long paper strip his favorite number n consisting of l digits. Unfortunately, the strip turned…
http://codeforces.com/contest/245/problem/H 题意:给定一个字符串,每次给个区间,求区间内有几个回文串(n<=5000) 思路:设定pd[i][j]代表i~j这部分是不是一个回文串,这个可以n^2预处理 然后设定f[i][j]代表i~j区间有多少个回文串,由于满足区间加减,因此有 f[i][j]=f[i+1][j]+f[i][j-1]-f[i+1][j-1]+pd[i][j] #include<cstdio> #include<cmath&…