December 2021 C/C++ (Level 6) real test analysis#中国电子学院#National Youth Software Programming Level Examination

insert image description here

C/C++ Programming (Level 1~8) All real questions・Click here

Question 1: Phone Number

Given some phone numbers, please judge whether they are consistent, that is, whether a certain phone number is a prefix of another phone number. For example:
Emergency 911
Alice 97 625 999
Bob 91 12 54 26
In this example, it is impossible for us to dial Bob’s phone number, because Emergency’s phone number is its prefix, and when dialing Bob’s phone number, Emergency will be connected first, so these The phone numbers are not consistent.
Time limit: 1000
Memory limit: 65536
input
The first line is an integer t, 1 ≤ t ≤ 40, indicating the number of test data. The first line of each test sample is an integer n, 1 ≤ n ≤ 10000, and each of the next n lines is a phone number with no more than 10 digits.
Output
For each test data, if it is consistent output "YES", if not output "NO".
Sample input
2
3
911
97625999
91125426
5
113
12340
123440
12345
98346

Guess you like

Origin blog.csdn.net/gozhuyinglong/article/details/132638507