擷取方案數

2021-09-18 00:01:16 字數 861 閱讀 9614

time limit: 1000 ms memory limit: 65536 k

total submit: 252(110 users) total accepted: 109(92 users) rating: special judge: no

description

給定乙個模式串t,主串s,問:從s中擷取t有多少種方案?

input

有多組測試資料,對於每組測試資料,第一行是模式串t,第二行是主串s,資料中僅包含大小寫字母和數字,模式串t長度不超過104,主串s長度不超過105。

注意:資料是隨機的。

output

對於每組測試資料,輸出一行,為擷取方案數。

sample input

abcabcdaabcab

abcd

abcdaabcab

abaabababa

sample output21

3直接套用kmp模板(不知道kmp是什麼的自行google)

#include

#include

char t[

10008

],s[

100008];

int next[

10008];

void

kmp_pre

(int len)

}int

kmpcount

(int lent,

int lens)

}return ans;

}int

main()

return0;

}

Hust oj 2060 擷取方案數(KMP)

擷取方案數 time limit 1000 ms memory limit 32768 k total submit 189 76 users total accepted 75 64 users rating special judge no description 給定乙個模式串t,主串s,問 ...

pgsql裝數卸數方案

裝數卸數方案 卸數流程 裝數流程 詳細操作參考 postgresql copy之表與檔案之間的拷貝 官方文件參考 常用示例 下面的例子把乙個表拷貝到客戶端,使用豎直條 作為域分隔符 copy country to stdout with delimiter 從檔案中拷貝資料到 country 表中 ...

雙指標 方案數

n 7 k 1 只有a,b abababa 最多修改1次 得到最長連續相同子串的方案數 maxx 3 方案數為5 第一遍雙指標求允許修改k個的最長連續子串長度maxx 第二遍判斷符合要求的區間有多少個 include using namespace std typedef long long ll ...