There are two natural numbers M, N, 2 <= m <= 99. Mr. S knows these two numbers and s, Mr. P knows the number of builds P. Their two have dialogue: s: I know what you don't know, but I don't know. P: Now I know these two numbers. S: Now I also know these two numbers. From these conditions, try to determine M, N.
Because S knows two sum, it is thus inference P not knows two numbers, so the two numbers must not be split into two prime numbers, that is, M, N cannot be a number of prime, and M, There will be no more than 50 prime numbers in n. Otherwise, M * N can be unique, P knows M, N's product must know M, N.
The information that can be determined from the speech from S is: 1. m, N will not be full of numbers; 2. M, N will not have more than 50 prime numbers; 3. M, N and the sum of N cannot be dismantled into two prime numbers; 4. Because s you don't know what these two numbers are, so these two numbers must be less than 99 98, otherwise s can know what these two numbers are.
S = M N satisfying the above conditions may:
111723272935374147196
Then P = M * n immediately calculates M, N, which shows that P = M * N is a special number with the following properties:
According to this special P, when S takes the values of the above, only one of the values of S make the equation M n = S, m * n = P has a unique integer solution in [2,99].
The following cases calculated according to this nature (may wish to set M <= N):
P = 18, S = 11, M = 2, n = 9p = 24, s = 11, M = 3, N = 8P = 28, S = 11, M = 4, n = 7p = 50, S = 27, M = 2, n = 25P = 52, s = 17, m = 4, n = 13p = 54, s = 29, m = 2, n = 27p = 76, s = 23, m = 4, n = 19p = 92, S = 27, M = 4, n = 23p = 96, S = 35, M = 3, N = 32P = 100, S = 29, M = 4, N = 25P = 110, S = 27, M = 5, n = 22p = 112, s = 23, m = 7, n = 16P = 114, s = 41, m = 3, n = 38P = 124, s = 35, M = 4, n = 31p = 130, S = 23, m = 10, n = 13p = 138, s = 29, m = 6, n = 23p = 140, s = 27, m = 7, n = 20p = 148, s = 41, m = 4, n = 37p = 150, s = 35, M = 5, n = 30p = 152, s = 27, m = 8, n = 19p = 154, S = 29, M = 7, N = 22p = 160, s = 37, M = 5, n = 32P = 162, s = 27, m = 9, n = 18p = 168, s = 29, m = 8, n = 21p = 170, s = 27, m = 10, n = 17P = 172, s = 47, m = 4, n = 43p = 174, s = 35, m = 6, n = 29P = 176, s = 27, m = 11, n = 16p = 182, s = 27, M = 13, n = 14p = 186, s = 37, M = 6, N = 31P = 190, s = 29, M = 10, N = 19p = 196, S = 35, M = 7, n = 28p = 198, s = 29, m = 11, n = 18p = 204, s = 29, m = 12, n = 17p = 208, s = 29, m = 13, N = 16P = 216, s = 35, M = 8, N = 27P = 232, s = 37, M = 8, N = 29P = 234, S = 35, M = 9, N = 26P = 238, s = 41, m = 7, n =
34P = 246, s = 47, m = 6, n = 41P = 250, s = 35, M = 10, N = 25P = 252, s = 37, M = 9, N = 28p = 270, S = 37, M = 10, n = 27p = 276, s = 35, M = 12, n = 23p = 280, s = 47, m = 7, n = 40P = 288, s = 41, m = 9, n = 32p = 294, S = 35, m = 14, n = 21p = 304, s = 35, M = 16, N = 19p = 306, s = 35, M = 17, N = 18p = 310, s = 41, m = 10, N = 31P = 322, S = 37, M = 14, N = 23p = 336, S = 37, M = 16, N = 21P = 340, S = 37, M = 17, N = 20P = 348, S = 41, M = 12, N = 29P = 364, s = 41, M = 13, N = 28p = 370, S = 47, M = 10, N = 37P = 378, S = 41, M = 14, N = 27P = 390, S = 41, M = 15, N = 26P = 396, S = 47, M = 11, N = 36P = 400, S = 41, M = 16, N = 25P = 408, s = 41, M = 17, N = 24P = 414, S = 41, M = 18, N = 23p = 418, S = 41, M = 19, N = 22P = 442, s = 47, M = 13, n = 34P = 462, s = 47, m = 14, n = 33P = 480, s = 47, m = 15, n = 32P = 496, s = 47, M = 16, N = 31P = 510, S = 47, M = 17, N = 30P = 522, S = 47, M = 18, N = 29P = 532, S = 47, M = 19, N = 28p = 540, S = 47, M = 20, N = 27P = 546, S = 47, m = 21, n = 26P = 550, s = 47, m = 22, n = 25P = 552, s = 47, m = 23, n = 24p = 9604, s = 196, m = 98, n = 98 final P to say that you already know M, N, s Also said that I know M, N, this shows that S can infer the only M, N based on the sum of the two numbers in their hands.
Therefore, it is also necessary to remove the case where the S is repeatedly used in the case, obtain the following case: p = 52, S = 17, M = 4, n = 13p = 9604, s = 196, m = 98, n = 98 if The last answer is M = 4, n = 13
Below is the program:
#include
Const int max_n = 99; const char * OUTPUT_FILE = "result.txt";
INT S [MAX_N * 2]; INT P [MAX_N * MAX_N]; int Prim [MAX_N]; int primcounter = 0;
OFSTREAM Fout (Output_File);
// Calcible Void Calprim () {bool buy [max_n]; INT I, P = 2; BOOL FOUND = true; Prim [Primcounter ] = 2; MEMSET (Used, False, Sizeof (Used)); While (Found) {For (i = p; i Found = false; For (i = p; i / / Filter VOID USECON_1 () {INT I, J; MEMSET (S, 0, SIZEOF (S)); for (i = 0; i <4; i ) s [i] = -1; Calprim (); // s can affirm p Don't know what these two numbers are For (i = 0; i For (i = 0; i For (i-; i // Because S himself doesn't know what for these for (i = 98 99; i Fout << "The sum of the sum of the first sentence" << Endl; for (i = 0; i / / Filter VOID USECON_2 () {INT I, M, N; MEMSET (P, 0, SIZEOF (P)); for (m ) for (n = 2; n < MAX_N; N ) {IF (S [M N]> = 0) {p [m * n] ;}} Fout << "Meets to meet the sum of the two words of P first sentence:" << Endl; For (i = 0; i Void usecon_3 () {INT I, M, N; Fout << "Meets the result of the S second sentence:" << endl; for (i = 0; i Void main () {usecon_1 (); usecon_2 (); usecon_3 ();}