2023 Huawei OD Machine Examination Paper B [Alarm Suppression] C Language Implementation

Table of contents

topic

Ideas

Code

Require


topic

Alarm suppression refers to the rules for high-priority alarms to suppress low-priority alarms. After a high-priority alarm is generated, a low-priority alarm will no longer be generated. Please provide the actual alarm list based on the original alarm list and alarm suppression relationship. There will be no cycle inhibition . The alarm will not be delivered, such as A->BB->C. In this case, A will not directly suppress C. However, the suppressed alarm can still suppress other low-priority alarms.
Input description
: The first line is a number N, indicating the number of alarm suppression relationships, 0<=N <=120
. The next N lines are two alarms separated by spaces. ID, for example: id1 id2, indicating that id1 suppresses id2. The format of the alarm ID is:
uppercase letters + 0 or 1 number.
The last line is the alarm generation list. The list length is [1,100].
Output description
Really generated alarm list

Note:
Alarm IDs are separated by a single space.


Example 1:
Input

2
AB
BC
ABCDE
output

ADE
shows that
A inhibits B, and B inhibits C࿰

Guess you like

Origin blog.csdn.net/misayaaaaa/article/details/133387443