#P3370. 【模板】字符串哈希
【模板】字符串哈希
Description
As stated, given strings (the length of the -th string is , and each string contains digits and letters in both cases; it is case-sensitive), find how many distinct strings there are among the strings.
Friendly reminder: if you really want to practice hashing seriously, please be self-disciplined.
Input Format
The first line contains an integer , the number of strings.
The next lines each contain one string, the provided strings.
Output Format
Output one line containing one integer, the number of distinct strings.
5
abc
aaaa
abc
abcc
12345
4
Hint
Constraints
For of the testdata: , , .
For of the testdata: , , .
For of the testdata: , , .
Sample Explanation
In the sample, the first string and the third string are the same, so the set of provided strings is , hence there are distinct strings.
Further Reading
The following problems reflect the correctness analysis of string hashing from different aspects.
- P12197 Hash Killer I
- P12198 Hash Killer II
- P12199 (currently unsolved) Hash Killer III
- P12200 Hash Killer Extra
- P12201 Hash Killer Phantasm
- P7350 「MCOI-04」Dream and Strings
Translated by ChatGPT 5
京公网安备 11011102002149号