摘要:
A. All with Pairs(KMP+Hash+map) 思路: 我们很容易想到的一个方法就是,就算出每个字符串的每个后缀的哈希值将其存入一个$map$,然后计算每个前缀的哈希值,在$map$中查看有多少个后缀的哈希值与其相同,累加即为答案 但是这样做有时候我们会重复计数,比如在对$“aba” 阅读全文
摘要:
A - Is It Easy ?(签到题) #include<iostream> #include<algorithm> using namespace std; int main() { int n,m; cin>>n>>m; cout<<n*m; } View Code B. Road to A 阅读全文
摘要:
A. Magical Sticks 思路: 尽可能的凑成长度为$n$的木棍,答案为$(n+1)/2$ #include<iostream> #include<algorithm> using namespace std; int main() { int t; cin>>t; while(t--){ 阅读全文