HDU 3065 病毒侵襲持續中

2021-06-12 07:57:45 字數 963 閱讀 9842

這就更簡單了,都不用把out標記成false了

題目中的病毒都是大寫字母這個條件應該怎麼用?

#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;

//max_node = stringnumber * stringlength

const int max_node = 50010;

//節點個數,一般字元形式的題26個

const int child_num = 128;

//特定題目需要

char test[2000010];

int cnt[1010];

char vernus[1010][50];

class acautomaton

} //重新建樹需先reset

void reset()

//將權值為key的字串a插入到trie中

void insert(char *a,int key)

p = chd[p][c];

} val[p] = key;

} //建立ac自動機,確定每個節點的權值以及狀態轉移

void construct()

} while (s != e) else

}} }

//解題,特定題目需要

void work()

}}}ac;

int main()

scanf("%s", test);

ac.construct();

ac.work();

for(int i = 1; i <= n; i++)

}return 0;

}

hdu 3065 病毒侵襲持續中

題目大意及思路 ac自動機。include include include include include include include include include include includeusing namespace std define inf 0x3f3f3f3f define ...

HDU 3065 病毒侵襲持續中

詢問每個模式串在文字傳中出現的次數。文字串中出現的字元不一定都是大寫字母,只需要在匹配的時候,對文字串進行特殊處理,將連續的大寫字母段當成合法的乙個文字串即可。然後 就是簡單的統計了。include include include include include include using name...

病毒侵襲持續中 HDU 3065

統計模式串出現次數。include include include include include include include include using namespace std typedef long long ll const int maxn 5e4 10 int trie maxn...