Deleting Numbers SOLUTION
This is an intelligent issue. There is an obscure whole number x (1≤x≤n). You need to discover x. From the outset, you have a lot of numbers {1,2,… ,n}. You can play out the accompanying activities close to multiple times:
An a: discover what number of numbers are products of an in the current set.
B a: discover what number of numbers are products of an in this set, and afterward erase all products of a, yet x will never be erased (regardless of whether it is a numerous of a). In this activity, an absolute necessity be more noteworthy than 1.
C an: it implies that you realize that x=a. This activity can be just performed once.
Recall that in the activity of type B a>1 must hold.
Compose a program, that will discover the estimation of x.
Info
The main line contains one number n (1≤n≤105). The rest of the pieces of the info will be given all through the communication cycle.
Connection
In each round, your program needs to print a line containing one capitalized letter A, B or C and a number a (1≤a≤n for tasks An and C, 2≤a≤n for activity B). This line desribes activity you make.
In the event that your activity has type C your program ought to end right away.
Else your program should peruse one line containing a solitary number, which is the solution to your activity.
In the wake of yielding each line, remember to flush the yield. To do it use:
fflush(stdout) in C/C++;
System.out.flush() in Java;
sys.stdout.flush() in Python;
flush(output) in Pascal;
See the documentation for different dialects.
It is ensured, that the number x is fixed and won’t change during the association cycle.
Hacks:
To make a hack, utilize such information design:
The main line ought to contain two numbers n, x (1≤x≤n≤105).
Model
inputCopy
10
2
4
0
outputCopy
B 4
A 2
A 8
C 4
Note
Note that to make the example more understood, we included additional unfilled lines. You shouldn’t print any additional vacant lines during the collaboration cycle.
In the principal test n=10 and x=4.
At first the set is: {1,2,3,4,5,6,7,8,9,10}.
In the primary activity, you solicit what number of numbers are products from 4 and erase them. The appropriate response is 2 on the grounds that there are two numbers detachable by 4: {4,8}. 8 will be erased however 4 won’t, on the grounds that the number x will never be erased. Presently the set is {1,2,3,4,5,6,7,9,10}.
In the subsequent activity, you solicit what number of numbers are products from 2. The appropriate response is 4 in light of the fact that there are four numbers distinct by 2: {2,4,6,10}.
In the third activity, you solicit what number of numbers are products from 8. The appropriate response is 0 in light of the fact that there isn’t any number distinguishable by 8 in the current set.
In the fourth activity, you realize that x=4, which is the correct answer.