Niki in Digikala's Fraud Detection department is looking for similar names for an…
- User
Niki in Digikala's Fraud Detection department is looking for similar names for an unknown reason. Instead of using probabilistic models, he tries to measure the similarity of two nouns with a strange method. Nicky puts a number of hyphens (-) inside both strings, from zero to infinity, to make the two strings equal in length (the final length of the two strings can grow to infinity). These dashes can be at the beginning, end, between the letters of the words, and several dashes can be placed together. Then he puts the two obtained strings next to each other and compares them letter by letter and considers the similarity of the two names equal to the sum of the points of the letters being placed together. The score of placing letters next to each other is calculated with the following rules:
If two dashes are placed next to each other, they will be given a minus 5 score
If a letter is placed next to a dashed line, they will be given a minus 5 score
If two letters are placed next to each other, their score is calculated from the following proximity matrix. Each number in this matrix shows the proximity of the letter corresponding to the row and column of that number. This matrix does not include some letters, because these letters do not exist in the names that reach Niki.
A C D E F G H I K L M N P Q R S T V W Y Plain text A 4 0 -2 -1 -2 0 -2 -1 -1 -1 -1 -2 -1 -1 -1 1 0 0 -3 -2 C 0 9 -3 -4 -2 -3 -3 -1 -3 -1 -1 -3 -3 -3 -3 -1 -1 -1 -2 -2 D -2 -3 6 2 -3 -1 -1 -3 -1 -4 -3 1 -1 0 - 2 0 -1 -3 -4 -3 E -1 -4 2 5 -3 -2 0 -3 1 -3 -2 0 -1 2 0 0 -1 -2 -3 -2 F -2 -2 -3 -3 6 -3 -1 0 -3 0 0 -3 -4 -3 -3 -2 -2 -1 1 3 G 0 -3 -1 -2 -3 6 -2 -4 -2 -4 -3 0 -2 -2 -2 0 -2 -3 -2 -3 H -2 -3 -1 0 -1 -2 8 -3 -1 -3 -2 1 -2 0 0 -1 -2 -3 -2 2 I -1 -1 -3 -3 0 -4 -3 4 -3 2 1 -3 -3 -3 -3 -2 -1 3 -3 -1 K -1 -3 -1 1 -3 -2 -1 -3 5 -2 -1 0 -1 1 2 0 -1 -2 -3 -2 L -1 -1 -4 -3 0 -4 -3 2 -2 4 2 -3 -3 -2 -2 -2 -1 1 -2 -1 M -1 -1 -3 -2 0 -3 -2 1 -1 2 5 -2 -2 0 -1 -1 -1 1 -1 -1 N -2 -3 1 0 - 3 0 1 -3 0 -3 -2 6 -2 0 0 1 0 -3 -4 -2 P -1 -3 -1 -1 -4 -2 -2 -3 -1 -3 -2 -2 7 - 1 -2 -1 -1 -2 -4 -3 Q -1 -3 0 2 -3 -2 0 -3 1 -2 0 0 -1 5 1 0 -1 -2 -2 -1 R -1 -3 -2 0 -3 -2 0 -3 2 -2 -1 0 -2 1 5 -1 -1 -3 -3 -2 S 1 -1 0 0 -2 0 -1 -2 0 -2 -1 1 - 1 0 -1 4 1 -2 -3 -2 T 0 -1 -1 -1 -2 -2 -2 -1 -1 -1 -1 0 -1 -1 -1 1 5 0 -2 -2 V 0 -1 -3 -2 -1 -3 -3 3 -2 1 1 -3 -2 -2 -3 -2 0 4 -3 -1 W -3 -2 -4 -3 1 -2 -2 -3 - 3 -2 -1 -4 -4 -2 -3 -3 -2 -3 11 2 Y -2 -2 -3 -2 3 -3 2 -1 -2 -1 -1 -2 -3 -1 -2 -2 -2 -1 2 7
Obviously, there are an infinite number of ways to include hyphens in strings. You should print the maximum score of two strings together in the output.
input The input consists of two lines, each line contains a string. The letters of this string are only from the letters inside the matrix and in capital letters. For example, the characters B or a do not exist in the input string. 0 < l e n g t h ( s t r 1 ) , l e n g t h ( s t r 2 ) < 1
000 0<length(str1),length(str2)<1000
output The output is an integer that represents the maximum score of the letter combination.
- Assistant
- User
Kianoush is applying for membership in OC organization. On the fourth day of the interview, the far-sighted organization examined him.
On the fourth day, Kianoush is taken to a city. in this city n There are n intersections with natural numbers 1 to n n are numbered. Between these intersections m m There is a one-way street. By using the tunnel and overpass, the streets do not meet each other outside the intersections. The municipality is located at intersection number 1 and we know that you can reach all the intersections from the municipality by using the roads. Kianoosh was told that one of the intersections may be blocked and traffic will not be allowed. In this case, the said condition may no longer be valid; It means that there is a city where every route from the municipality to it passes through the blocked intersection and now it cannot be reached from the municipality. If this problem occurs with intersection blockage, we call it a critical intersection.
- Assistant
- User
The jams, who liked solving the riddle, asked their elder to tell them another riddle. After thinking for a while, the big man of the jams proposed this riddle to the jams:
A right triangle n x n We have n×n. Triangle of n n column formed that column i iam of it, n
i has n−i rows. in m m of the houses of the triangle of jam, and honey is placed in the rest of the houses. A subtriangle k ktai indicates the sharing of houses k k row and k k is their corresponding column of the triangle. A good subtriangle is a subtriangle with jam in all its houses. Also, a lovely sub-triangle is a sub-triangle that has two jams for each row, in the group of houses of that row and its corresponding column. Moreover, a strange subtriangle is a subtriangle that is lovely, but none of its subtriangles are lovely.
- Assistant
- User
c++
- Assistant