G
G
Gagatyn2017-05-03 18:48:20
C++ / C#
Gagatyn, 2017-05-03 18:48:20

How are these types of problems solved?

I can not solve this problem, help me out, tell me how to solve it. Just details please.
To encrypt a text of m letters, choose a square matrix of order n, (n^2) > m and fill it in lines with plain text, and then transform it according to some rule so that the ciphertext is obtained from the phrase "love informatics" written as a e8c7558dbdc34442af1d0ebb47ce07e6.PNGmatrix , represented as a one-dimensional array B = |toikrulimuanyubfl| . Encrypt arbitrary text in the specified way, using the algorithm below, into which you need to insert the values ​​of unknown indices of array A.

p:=0;
нц для i от 1 до n
  нц для j от 1 до i
    p:=p+1; r:=mod(i,2); d:=mod(r+1,2);
    B[p]:=A[d*Q+r*V, d*W+r*Z]; 
  кц;
кц;

Then the expressions (2Q+W)(V+2Z) and (XY)(G+S) will look like:
Answers:

1) (i+1+j)^2 и (i+1-2j)(2n-i+1)
2) (2i-j+2)^2 и (2j-i-1)(2n-i+1)
3) (3n-2i+j+1)^2 и (i+1-2j)(i+1)
4) (3n-i-j+2)^2 и –(i+1)^2
5) (2n+2-2i+j)(n+3+2i-3j) и (i-n)(n+2j-i)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daemon23RUS, 2017-05-03
@Gagatyn

It can be on a piece of paper, you can write a thread. Since the answer is known, I will share my vision of the solution. In Algorithm 4, the unknowns Q, V, W, Z are [d*Q+r*V, d*W+r*Z]; To get array B, you need to make a selection from A with dimensions n [n,1] [(n-1),1] [n,2] [n,3] [n(-1),2] [(n-2) ,1] [(n-3),1] [(n-2),2] [(n-1),3] (if I didn't typo, the selection snakes diagonally) 2 loops iterate over i and j + a sign of an even and odd line (2pcs) and using these 4 values, you need to compose Q, V, W, Z in such a way that the sampling order matches. Next, substitute the found values ​​\u200b\u200binto this formula (2Q + W) (V + 2Z) and compare the answer.
But I don’t understand one thing, the above algorithm does not allow you to completely encode array A.
Mb a typo in the condition

nc for j from 1 to i

V
V Sh., 2017-05-03
@JuniorNoobie

I don’t know if this will help you, but here I tried to solve something using an example. The result is displayed in the browser console (F12 -> Console). The result was an excessive system of equations, from where you can find Q, W, V, Z (as I understand it, X, Y, G, S is for another option, or what is it in general?).
And what is this task anyway? Olympic? Do you need access to a computer for a solution or on a piece of paper?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question