51nod1814 Clarke and string】的更多相关文章

[传送门] 直接想最暴力的做法就是正解了.每次询问都把两个串的回文树建出来,然后再两棵树上同时dfs,经过相同的节点答案就加一.遇到一个不存在的就退出.再把询问记忆化一下就OK了.复杂度是 $O(n \sqrt n)$因为每次dfs的复杂度跟短的串的长度有关.自己写给写T了.学习了下优秀写法.多开一个数组表示next是不是当前的next的.这样就不用每次都清数组了. #include <bits/stdc++.h> #define pii pair<int, int> #defin…
Clarke and puzzle Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5465 Description 克拉克是一名人格分裂患者.某一天,有两个克拉克(aa和bb)在玩一个方格游戏. 这个方格是一个n*mn∗m的矩阵,每个格子里有一个数c_{i, j}c​i,j​​. aa想开挂,想知道如何打败bb. 他们要玩qq次游戏,每一次做一次操作: 1. 取出当中的一…
Clarke and points Problem Description   The Manhattan Distance between point A(XA,YA) and B(XB,YB) is |XA - XB| + |Xb - YB|;the coordinate of each point is generated by the followed code.Input long long seed;inline long long rand(long long l, long lo…
Problem Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of geometric.  He did a research on a interesting distance called Manhattan Distance. The Manhattan Distance between point A(xA,yA) and point…
Problem Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of graph theory.  He learned some algorithms of minimum spanning tree. Then he had a good idea, he wanted to find the maximum spanning tree w…
Clarke and digits Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Clarke is a patient with multiple personality disorder. One day, Clarke turned into a researcher, did a research on digits. He w…
今天第二次做BC,不习惯hdu的oj,CE过2次... 1002 Clarke and problem 和Codeforces Round #319 (Div. 2) B Modulo Sum思路差不多, 将a[i]对p取余数,最后得到0的方案总数即使答案,dp转移,一个状态方案总数等于能转移过来的状态方案数之和 #include<cstdio> #include<iostream> #include<string> #include<cstring> #i…
Clarke and minecraft 问题描述 克拉克是一名人格分裂患者.某一天,克拉克分裂成了一个游戏玩家,玩起了minecraft.渐渐地,克拉克建起了一座城堡. 有一天,克拉克为了让更多的人分享自己的成果,开了局域网,并且选择创造模式.不幸的是,这一天有一个熊孩子进了克拉克的游戏,他在克拉克的城堡里放了很多个爬行者!当刚刚去外面打怪回.开着生存模式的克拉克回到城堡中的一瞬间,爬行者们突然自爆......(自行脑部画面)于是克拉克的城堡变成了一片废墟,圆石.木板.砖块等建筑材料撒落了一地…
Clarke and baton  Accepts: 14  Submissions: 79  Time Limit: 12000/6000 MS (Java/Others)  Memory Limit: 524288/524288 K (Java/Others) 问题描述 克拉克是一名人格分裂患者.某一天,克拉克fork出了nn个自己,序号从11到nn. 他们准备玩一个减肥游戏,每一个克拉克都有一个体重a[i]a[i].他们有一个接力棒,这个接力棒任何时刻总是在最重的克拉克(如果重量相同则在序…
Clarke and digits  Accepts: 16  Submissions: 29  Time Limit: 5000/3000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 克拉克是一名人格分裂患者.某一天,克拉克变成了一个研究人员,在研究数字. 他想知道在所有长度在[l, r][l,r]之间的能被77整除且相邻数位之和不为kk的正整数有多少个. 输入描述 第一行一个整数T(1 \le T \le…