【思路】:利用vector的动态特性和相关操作很容易实现。可以算第一次真正用STL做题,算开始了我的STL之旅吧。
【AC代码】:
#include
#include
#include
#include
using namespace std;
#define MAX 100+10
bool Comp(const int &a,const int &b)
{
return a...
分类:
其他好文 时间:
2015-03-17 10:37:02
阅读次数:
291
【思路】:大数基本都是这思路,采用数组或者字符串,每个数采用倒序的方式从头开始存储。每次进位进到下一位上。
【AC代码】:两个数组来回颠倒。
#include
#include
#include
#include
#include
#include
using namespace std;
#define MAX 3000
int cal(int *s, int len, in...
分类:
其他好文 时间:
2015-03-16 23:11:46
阅读次数:
236
【思路】:大数处理都一样。
【AC代码】:代码细节可以美化一下。
#include
#include
#include
#include
#include
#include
using namespace std;
#define MAX 100+10
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out....
分类:
其他好文 时间:
2015-03-16 23:11:18
阅读次数:
252
http://acm.hdu.edu.cn/showproblem.php?pid=2076数学题。。。公式推出来就可以AC了。思路:分别求出时针和分针与12点的位置的夹角大小,输出夹角的差值,注意取小于180度的角。代码如下:#includeint main(){ int t; dou...
分类:
其他好文 时间:
2015-03-15 21:16:23
阅读次数:
159
dp[i][j] 表示,在AC自动机中,从根节点开始,走了i条边,并且经过的点不包含危险节点,走到了j节点的路径数。收获: 1、正难则反 2、一个字符串不包含给定pattern中的任何一个,则该字符串在AC自动机上走时不会走到“危险节点”。 3、DFS可以做的事情,可以考虑DP来做。 1 #i...
分类:
其他好文 时间:
2015-03-15 16:46:29
阅读次数:
135
问题描述作为史上最强的刷子之一,zhx在各大oj上交了很多份代码,而且多数都AC了。有一天,zhx想数一数他在n个oj上一共交了多少份代码。他现在已经统计出在第i个oj上,他交了ai份代码。而把它们加起来就是你的工作了。当然zhx是一个不走寻常路的人,所以他的数字都是用B进制表示的。而他也要求你告诉...
分类:
其他好文 时间:
2015-03-15 13:51:51
阅读次数:
139
字符串也是ACM中的重头戏,基本内容有KMP ,扩展KMP, Manacher ,AC自动机,后缀数组,后缀自动机.按照专题来做共分三部分. LCS LIS LCIS不知道算不算....点击打开链接
小技巧:匹配问题不区分大小写,则将其全部转为小写.
暴力匹配: 用strstr函数就能解决 I M N Z(枚举长度 三份)
一.KMP算法
解决单一模式串匹配问题.
利用失配后...
分类:
其他好文 时间:
2015-03-15 12:31:10
阅读次数:
377
Problem Description
As one of the most powerful brushes, zhx submits a lot of code on many oj and most of them got AC.
One day, zhx wants to count how many submissions he made on
n
ojs. He knows...
分类:
其他好文 时间:
2015-03-15 09:27:34
阅读次数:
133
转载请注明出处:http://www.cnblogs.com/fraud/ ——by fraudDNA SequenceTime Limit: 1000MSMemory Limit: 65536KDescriptionIt's well known that DNA Sequence is a se...
分类:
其他好文 时间:
2015-03-15 00:37:31
阅读次数:
184
给定n个模式串在主串中出现了几个#include #include const int MAXPT=500007; //最大节点数const int size=26; //子节点数const char start='a'; //子节点标号对应关系 class Ac_Automat{pr...
分类:
其他好文 时间:
2015-03-15 00:35:39
阅读次数:
162