QOJ.ac

QOJ

时间限制: 2 s 内存限制: 512 MB 总分: 100

#1424. 猫

统计

通过连接字符串 $a$ 的非空后缀和字符串 $b$ 的非空前缀,可以得到多少个不同的字符串?

输入格式

第一行包含一个整数 $t$ ($1 \le t \le 10^5$),表示测试用例的数量。

每个测试用例由两行组成,分别包含字符串 $a$ 和 $b$。两个字符串均由小写英文字母组成,长度在 $1$ 到 $10^5$ 之间(含边界)。

所有测试用例中字符串的总长度不超过 $2 \cdot 10^5$。

输出格式

对于每个测试用例,输出所需的数量。

样例

输入格式 1

5
abb
bba
aaa
aaaaa
winter
camp
ehehe
heheh
aaaaaaabaaaa
aabaaaaaa

输出格式 1

8
7
24
16
97

说明

在第一个测试用例中,所有可得到的字符串为 abbb, abbbb, abbbba, bb, bbb, bbba, bbbb, bbbba。

在第二个测试用例中,只能得到长度至少为 2 且至多为 8 的由字母 a 组成的字符串。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.