[Codeforces 176B]Word Cut】的更多相关文章

Word Cut Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 176B Description Let's consider one interesting word game. In this game you should transform one word into another through specia…
Word Cut 题目连接: http://codeforces.com/problemset/problem/176/C Description Let's consider one interesting word game. In this game you should transform one word into another through special operations. Let's say we have word w, let's split this word in…
B. Word Cut   Let's consider one interesting word game. In this game you should transform one word into another through special operations. Let's say we have word w, let's split this word into two non-empty parts x and y so, that w = xy. A split oper…
Description Let's consider one interesting word game. In this game you should transform one word into another through special operations. Let's say we have word w, let's split this word into two non-empty parts x and y so, that w = xy. A split operat…
Description 题库链接 给你两个字符串 \(S\) 和 \(T\) ,准许你 \(k\) 次操作,每次将字符串左右分成两个非空的部分,再交换位置,问你有多少种不同的操作方法将 \(S\) 串变为 \(T\) 串. \(1\leq k\leq 100000, 1\leq |S|=|T|\leq 1000\) Solution 容易发现不论经过多少次操作,其操作后的字符串一定是在原字符串上截开两段再拼接而成. 所以不妨记 \(f_{i,j}\) 为操作 \(i\) 次后在 \(j\) 处截…
题目链接: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=28214 题目大意:源串有如下变形:每次将串切为两半,位置颠倒形成新串.问经过K次变形后,与目标串相同的变形方案数.mod 1000000007. 解题思路: 奇葩的字符串DP.照着别人的题解写的,解释不出原理是什么. 首先统计出经过1次变形,就能和目标串相同的中间产物串(包含源串)的个数cnt.len表示源串长度,那么len-cnt就表示和目标串不同的个数. 用…
题目链接:http://codeforces.com/problemset/problem/883/H Time limit: 3000 ms Memory limit: 262144 kB Kolya has a string s of length n consisting of lowercase and uppercase Latin letters and digits. He wants to rearrange the symbols in s and cut it into th…
Cut 'em all! 题意:求删除了边之后,剩下的每一块联通块他的点数都为偶数,求删除的边最多能是多少. 题解:如果n为奇数,直接返回-1,因为不可能成立.如果n为偶数,随意找一个点DFS建树记录下他的子孙+本身的个数.然后再DFS一下,对于每一个点,他的个数为偶数,就把他与父节点的边隔断, cnt++. 最后cnt就是答案. 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.t…
time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output Polycarpus has a ribbon, its length is nnn. He wants to cut the ribbon in a way that fulfils the following two conditions: After the…
#include<cstdio> #include<cstring> #include<cmath> #include<stack> #include<vector> #include<string> #include<iostream> #include<algorithm> using namespace std; long long L,R,K; long long POW(long long m,lon…