May 2023 C/C++ (Level 8) real question analysis #中国 Electronics Society # National Youth Software Programming Level Examination

Insert image description here

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

Question 1: Road

N cities numbered 1...N are connected by one-way roads:. Each road contains two parameters: the length of the road and the toll (expressed in the number of gold coins) that needs to be paid for the road
. After cheating, Bob breaks up with her and decides to move to city N. He wanted to get there as quickly as possible, but he was short of money. We hope to help Bob find the shortest path from 1 to N, provided he can afford the toll.
Time limit: 1000
Memory limit: 65536
input
The first line contains an integer K, 0 <= K <= 10000, representing the maximum number of gold coins that Bob can spend on his way. The second line contains the integer N, 2 <= N <= 100, which refers to the number of cities. The third line contains the integer R, 1 <= R <= 10000, the number of directions. In the next R line, each line specifies several integers S, D, L and T to illustrate some conditions about the road. These integers Separated by spaces: S is the starting city of the road, 1 <= S <= ND is the ending city of the road, 1 <= D <= NL is the length of the road, 1 <= L <= 100 T is

Guess you like

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