题意 求两点之间有多少不同颜色的路径
范围比较小 可以直接floyd
#include
#include
using namespace std;
const int N = 105;
int d[N][N][N], ans;
int main()
{
int a, b, c, n, m, q;
while(~scanf("%d%d", &n, &m))
{
...
分类:
其他好文 时间:
2015-01-19 09:14:48
阅读次数:
114
T_T越来越水了,这次只做出A+B.A题为了代码简单直接枚举(插入位置和插入字符) 1 //CF #286 Div.2 A 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #define r...
分类:
其他好文 时间:
2015-01-19 00:13:01
阅读次数:
285
C.Misha and Forest (图论 BFS)比赛进行了一半才想起来有场CF没打,=_=||前两道题快速切掉,C题一直卡没什么好的思路憋了几天,忍不住偷偷瞄了一下别人AC的代码,发现我题没看清题目,题中说了给出的图是森林。于是切入点找到了!题意:一个由n个节点构成的森林,编号从0到n-1,给...
分类:
其他好文 时间:
2015-01-16 22:05:24
阅读次数:
220
Codeforces 285这场rating又掉了,好在只掉了十多。题目比较水,但是我比赛时居然只艰辛地过了前两道。504A由于图是森林,所以一定有度为1的点,把这些点删了后图还是森林。然后就完了。比赛的时候居然把森林当成了树,交了3次才过。504B把排列表示为一个n元组\( (p_0, p_1, ...
分类:
其他好文 时间:
2015-01-16 16:07:59
阅读次数:
217
题目链接:http://codeforces.com/problemset/problem/504/E题意:给出一棵树,每个结点上有一个字母。每个询问给出两个路径,问这两个路径的串的最长公共前缀。思路:树链剖分,记录每条链的串,正反都记,组成一个大串。记录每条链对应的串在大串中的位置。然后对大串求后...
分类:
编程语言 时间:
2015-01-15 19:58:21
阅读次数:
351
#include#include#include#include#include#include#includeusing namespace std;#define INF 11) { if(sum<ans) ...
分类:
其他好文 时间:
2015-01-15 12:20:09
阅读次数:
134
E. Distributing PartsYou are an assistant director in a new musical play. The play consists of n musical parts, each part must be performed by exactly...
分类:
其他好文 时间:
2015-01-14 21:19:36
阅读次数:
252
D. Tennis GamePetya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, ...
分类:
其他好文 时间:
2015-01-14 21:13:03
阅读次数:
180
经过了一个多月的时间,今天终于可以回到正轨了,继续开始刷CF。
题目大意:
给出一个只有括号的字符串,求最长“匹配”子串的长度和数量。
解题思路:
设置数组记录匹配括号段的开头。
下面是代码:
#include
#include
#include
#include
#include
#include
#include
#include
#incl...
分类:
其他好文 时间:
2015-01-14 14:17:58
阅读次数:
124
Winner
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
The winner of the card game popular in Berland "Berlogging" is determined ac...