![]() For the entire game, N operations are performed. The rules of the game are:Īt the beginning of the game, the number P is zero. You have to help them: write a program with which they could check their calculations. Roma and Vitala came up with the following game: add and subtract from the number of power two, and after each operation count the number of units in the binary number of this number. Hi CF! I find problem sqrt decomposition. The only output line must contain one number equal to the remainder of dividing the number of path lines of length L in column G by 1 000 000. Elements of each line are separated from each other by spaces. Each of these lines contains two natural numbers a, b (1 ≤ a, b ≤ n) and a small Latin letter c, which means the presence of an arc from the vertex a to the vertex b marked with the symbol c. The next m rows define the arcs of the graph G. The first line of the input data contains integers n, m, L (1 ≤ n ≤ 10, 1 ≤ m ≤ 10 000, 1 ≤ L ≤ 100) equal to the number of vertices and edges of the graph G, and also the length of the path lines that need to look for. Your task is to calculate the remainder of dividing by 1 000 000 the number of waypoints of graph G consisting of exactly L symbols. We call the string S the path line of the graph G if there exists a path in it whose path label is S. ![]() Each path in graph G can be put in correspondence with a string consisting of letters written on successively paths that pass through this path. Each arc of the graph is marked by some letter of the Latin alphabet. In the graph G, there may be several arcs between the same pair of vertices, as well as arcs leading from the vertex to it. can you help me problem on the dp.Ĭonsider an oriented graph G having n vertices numbered by positive integers from 1 to n.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |