2012年8月1日

[字符串]

摘要: 题目:给出一个整数n,问1-n之间包括n在内的所有数中49出现的次数。输入首先为一个整数T,表示接下来有T组输入。# include <cstdio># include <cstring># define N 10000000# define LEN 22typedef long long int LL;LL f[LEN][10];LL pow10[LEN];void init(void){ pow10[0] = 1; for (int i = 1; i < LEN; ++i) { pow10[i] = 10*pow10[i-1]; if (i>=... 阅读全文

posted @ 2012-08-01 23:44 getgoing 阅读(151) 评论(0) 推荐(0) 编辑

HDOJ 2896 病毒侵袭

摘要: WA;这道题题意不清晰,单词相互包含的要不要计算?网上AC的程序跑出来的结果都不太一样,我的是计算在内的。 1 # include <cstdio> 2 # include <cstring> 3 # include <queue> 4 # include <algorithm> 5 6 using namespace std; 7 8 # define WORD_LEN 200 + 5 9 # define TEXT_LEN 10000 + 5 10 # define ALPHA_SIZE 128 + 5 11 12 int n, m, tot 阅读全文

posted @ 2012-08-01 13:40 getgoing 阅读(192) 评论(0) 推荐(0) 编辑

HDOJ 2222 Keywords Search

摘要: Accepted2222593MS30816K2430 BG++第一道 AC 自动机,理解了就好写;需要注意字典可能重复,重复的不能按一次算。# include <cstdio># include <cstring># include <queue>using namespace std;# define WORD_LEN 50 + 5# define MAXN 10000 + 5# define ALPHA_SIZE 26int n, id;char t[1000000 + 10];char w[MAXN][WORD_LEN];struct node{ n 阅读全文

posted @ 2012-08-01 11:41 getgoing 阅读(380) 评论(0) 推荐(0) 编辑

导航