A Secret
来源:互联网 发布:淘宝上的台式机 编辑:程序博客网 时间:2024/05/16 08:33
A Secret
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 256000/256000 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0
Problem Description
Today is the birthday of SF,so VS gives two strings S1,S2 to SF as a present,which have a big secret.SF is interested in this secret and ask VS how to get it.There are the things that VS tell:
Suffix(S2,i) = S2[i...len].Ni is the times that Suffix(S2,i) occurs in S1 and Li is the length of Suffix(S2,i).Then the secret is the sum of the product of Ni and Li.
Now SF wants you to help him find the secret.The answer may be very large, so the answer should mod 1000000007.
Suffix(S2,i) = S2[i...len].Ni is the times that Suffix(S2,i) occurs in S1 and Li is the length of Suffix(S2,i).Then the secret is the sum of the product of Ni and Li.
Now SF wants you to help him find the secret.The answer may be very large, so the answer should mod 1000000007.
Input
Input contains multiple cases.
The first line contains an integer T,the number of cases.Then following T cases.
Each test case contains two lines.The first line contains a string S1.The second line contains a string S2.
1<=T<=10.1<=|S1|,|S2|<=1e6.S1 and S2 only consist of lowercase ,uppercase letter.
The first line contains an integer T,the number of cases.Then following T cases.
Each test case contains two lines.The first line contains a string S1.The second line contains a string S2.
1<=T<=10.1<=|S1|,|S2|<=1e6.S1 and S2 only consist of lowercase ,uppercase letter.
Output
For each test case,output a single line containing a integer,the answer of test case.
The answer may be very large, so the answer should mod 1e9+7.
The answer may be very large, so the answer should mod 1e9+7.
Sample Input
2aaaaaaaabababababa
Sample Output
1319Hintcase 2: Suffix(S2,1) = "aba",Suffix(S2,2) = "ba",Suffix(S2,3) = "a".N1 = 3,N2 = 3,N3 = 4.L1 = 3,L2 = 2,L3 = 1.ans = (3*3+3*2+4*1)%1000000007.
阅读全文
1 6
- A Secret
- creat a secret folder
- overflow - a secret benifit
- A - Secret Number
- HDU6153-A Secret
- HDU 6153 A Secret
- hdu-6153 A Secret
- [kmp] hdu6153 A Secret
- A Secret HDU
- HDU6153-A Secret
- hdoj 6153 A Secret
- A Secret(KMP)
- hdu-6153 A Secret
- HDU 6153 A Secret
- hdu--6153(A Secret)
- LightOJ 1101 A Secret Mission
- hdu 6153 A Secret KMP
- HDU_6153 A Secret【扩展KMP】
- Friend-Graph
- iOS开发中OC与H5网页交互之OC传值给JS(WKWebView)
- 数论中的一些模板
- oracle 学习笔记
- ISCSI网络存储服务器
- A Secret
- ajax对json的使用
- CaoHaha's staff
- 二叉树排序(前序、中序、后序)
- tensorflow gpu 0.12.1 版本与python对应关系及下载地址
- 第二十天总结
- 多线程快速入门
- Subsequence Count
- (二)SSM中mybatis一对一查询