October 1 topic describes the daily practice

1. The greatest common divisor and least common multiple problem issues

Title Description

Enter two positive integers \ (X0, yO (2 \ Le X0 \ lt 100000, 2 \ Le yO \ 1000000 Le) \) , satisfying the following conditions to obtain P, Q number.
condition:

  1. P, Q are positive integers
  2. Requirement P, Q greatest common divisor to x0, y0 to least common multiple.

Test requirements: satisfy the condition of all possible two integer positive number.

Input Format

Two positive integers x0, y0

Output Format

The number 1 indicates the condition of the determined P, Q number

Sample input

3 60

Sample Output

4

Description / Tips

P, Q there are four kinds:

  1. 3,60
  2. 15,12
  3. 12,15
  4. 60,3

Question 2. Number of columns

Title Description

Given a positive integer \ (k (2 \ k Le \ Le 15) \) , the k for all k and all of a power of a finite number of mutually Powers and the like constituting an ascending sequence, for example, when the \ (k = 3 \) when this sequence is:
1,3,4,9,10,12,13, ...
(which is actually the sequence: \ 3 ^ (3 ^ 0,3 ^ 0 + l, 3 ^ + ^ 0. 3. 3. 3 ^ 2,3 ^ 0 ^ + ^. 1 + 2. 3, \ DOTS \) )
you obtain the second sequence \ (N \) value of the item (10 hex number indicates).
For example, \ (K =. 3, N = 100 \) , the correct answer is 981.

Input Format

Two positive integers, separated by a space:
\ (kN \) ( \ (K \) , \ (N \) defined above described problems consistent, and \ (2 \ le k \ le 15, 10 \ N Le \ Le 1000 \) ).

Output Format

A positive integer. (No spaces and other symbols before integer).

Sample input

3 100

Sample Output

981

Description / Tips

NOIP 2006 universal groups fourth title

Question 3. cell division

Title Description

Dr. Hanks is a well-known expert BT (Bio-Tech, biotechnology) field. Now, he is preparing for the test cell: cell culture samples.
Dr. Hanks hands now \ (N \) types of cells, numbered from \ (1 \) to \ (N \) , a section \ (I \) types of cells can be split 1 sec \ (Si \) th the same kind of cells ( \ (Si \) is a positive integer). Now he needs to select a certain cell into the culture dish, let freedom split, cultured. After a period of time, then all of the cells into culture dishes average \ (M \) test tubes, forming \ (M \) parts of the sample for the experiment. Dr. tube number as Hanks \ (M \) is large, the basic data types can not be stored in a general computer such large \ (M \) values, but fortunately, \ (M \) can always be represented as \ (m_1 \ ) a \ (M_2 \) th power, i.e. \ (M_2 M = {^ m_1} \) , where \ (m_1, m_2 \) positive integer RC basic data types can be stored.
Note that, allowed to separate individual cells throughout the course of the experiment, such as a time when there are four cell culture dish,
Dr. Hanks they can be divided into 2 test tubes, 2 per tube, then the start of the experiment.
However, if there are 105 cells in petri dishes, they will not average Dr into two tubes. At this point, Dr. can only wait for some time, so that the cells continue to divide them so that the number can be divided equally, or simply change to another cell culture.
In order to allow early start of the experiment, Dr. Hanks selected one cell after culture initiation, always resulting cells "may mean exactly divided into \ (M \) test tubes" stop and start the experiment when the cell culture. Dr. now want to know, what kind of selection in cell cultures, may make the earliest start time of the experiment.

Input Format

The first line, there is a positive integer \ (N \) , representative of the number of cell types.
Second row, there are two positive integers \ (m_1, M_2 \) , separated by a space, i.e. represents the total number of test tube \ (M_2 M = {^ m_1} \) .
The third row has \ (N \) positive integer, the i-th \ (S_i \) represents the i-th cell 1 sec can be split into a number of different types of cells.

Output Format

An integer representing the cultured cells to a minimum from the start of the experiment can be the time elapsed (in seconds).
Regardless if the cells are selected Dr. Hanks not meet the requirements, the output of the integer -1.

Sample input 1

1 
2 1 
3

Sample output 1

-1

Sample input 2

2
24 1
30 12

Sample output 2

2

Description / Tips

[O] Description
1 sec, split into three cells, after 2 seconds, split into nine cells, ...... can be seen that no matter how division, cell number is odd, and therefore can never be divided into two test tubes.

Sample 2 [O] described
first type of cells to the first split into 24 tubes after 3 seconds, while the second type after the first 2 seconds to the average (per tube \ (144/24 = 6 \) a). Therefore, the earliest start the experiment after 2 seconds.

[Data] range
for 50% of the data, there are \ (^ m_1} {M_2 \ 30000 Le \) .
For all data, there are
\ (. 1 \ Le N \ 10000 Le,. 1 \ Le m_1 \ 30000 Le,. 1 \ Le M_2 \ 10000 Le,. 1 \ Le S_i \ Le 2,000,000,000 \) .
NOIP 2009 universal Group III title

Question 4. Stack

Title Description

Background of
the stack is in the classic computer data structures, simply, the stack is limited to the insertion end of the linear table delete operation.
There are two most important stack operation, i.e., pop (pop up from a stack element) and a push (a push element).
The importance of the stack without saying that any one course will introduce stack data structure. Ningning students in the basic concepts review the stack, think of a book on the issue is not talked about, but he could not give an answer, so they need your help.
Title Description

Nene contemplated that such a problem: the number of a sequence of operations, 1,2, ..., n (illustrated as Case 1 to 3), the depth of the stack A is greater than n.
Can now be used for both operations,
a number, the operand move from the head end of the sequence (corresponding to the data structure of stack push operation) of the head end of the stack
will be a number, the head end moves from the trailing end of the stack of the output sequence ( corresponding data structure stack pop operation)
using the two operations, by the operation of a sequence number can be obtained a series of output sequence, the process 123 generates a sequence 231 is shown in the figure by.

(Original state as shown above)
your program will be given n, and outputs calculated by the operand sequence 1,2, ..., the total number of the output sequence may be obtained through the operation.

Input Format

Input file contains only one integer \ (n (1 \ le n \ le 18) \)

Output Format

Output file only 11 lines, that is, the total number of possible output sequences.

Sample input

3

Sample Output

5

The prime factor decomposition problem

Title Description

To give you a positive integer \ (n-\) , please \ (n-\) decomposition of the quality factor, and outputs a corresponding result format according to the sample output.

Input Format

Input contains a positive integer \ (n-(. 1 \ n-Le \ Le ^ 10. 9) \) .

Output Format

According to the output format of the output sample \ (n-\) results in decomposition of the quality factor. Note: prime factors need to follow the order from left to right to increase.

Sample input 1

12

Sample output 1

12=2^2*3

Sample input 2

600

Sample output 2

600=2^3*3*5^2

Guess you like

Origin www.cnblogs.com/zifeiynoip/p/11738442.html