HUAWEI OD Machine Examination Questions - Courier delivery problem [2023Q2] [JAVA, Python, C++]

Title description:

There are N express stations identified by strings, and some stations are connected by roads. There are some packages to be transported at each site, and the packages between each site are not repeated.
There are checkpoints on the road that will cause some goods to be impassable. Calculate which goods cannot be delivered normally

Enter a description:

Enter MN in the first line, M packages and N road information. 0<=M, N<=100, if there are multiple packages that are prohibited from passing through the checkpoint, separate them with spaces

4 2
package1 A C
package2 A C
package3 B C
package4 A C
A B package1
A C package2 package4

Output description:

Output undeliverable package package2 package4, if all packages can be delivered, output none, and the output results are sorted in ascending order

Supplementary note:

 put away

Example 1

enter:

4 2
package1 A C
package2 A C
package3 B C
package4 A C
A B package1
A C package2

output:

package2

illustrate:

info = list(map(int, input().split(' ')))
dict = {}
dict1 = {}
for i in range(info[0]):
    package = input().split(' ')
    dict[package[0]] = package[1: 3]

for i in rang

Guess you like

Origin blog.csdn.net/2301_76848549/article/details/130163180