1317 - CSI2P(I)_Chen_Lab2_Make-up Scoreboard

Time

2017/11/01 20:10:00 2017/11/01 22:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11154 Swap Matrix row
11591 Book Donation Program
11598 Word rotation

11154 - Swap Matrix row   

Description

Given a 5*5 matrix, your job is to swap two specific rows i and j (where 0 <= i,j < 5) several times.

 

For example:

 

Consider a matrix,

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

16 17 18 19 20

21 22 23 24 25

and the two rows (i,j) = (1,3).

 

After swap, the matrix will become

1 2 3 4 5

16 17 18 19 20

11 12 13 14 15

6 7 8 9 10

21 22 23 24 25

 

Input

The input consists of two parts.

 

The first part contains a 5*5 matrix.

 

The first line of the second part contains an integer N ( 0 < N <= 5 ), indicating the number of swaps.

In the next N lines, each contains 2 integers i,j ( 0 <= i,j < 5 ).

 

Hint:

You can use the following code to read input.

i=0;
while(i<5) {
    j=0;
    while(j<5) {
        scanf("%d",&matrix[i][j]);
        j++;
    }
    i++;
}
scanf("%d",&times);
while(times>0){
scanf("%d%d",&input[0],&input[1]);
…
times--;
…

Output

The final matrix.

Note that you need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11591 - Book Donation Program   

Description

Twilight Sparkle is an aspiring pony lives in Equestria. She has a large collection of books, all of which are stored in bookcases in her house. For each bookcase, the books stored in it is labelled 1, 2, 3, .... and so on.

One day, she decides to participate in a book donation program. For each bookcase in her house, she wants to pick up one book for donation.

Here is how Twilight chooses the books :

Each time she will ask her friend Spike to give her two random number x and n. Twilight wants to find out the n-th smallest prime p that is equal or greater than x. For this bookcase, Twilight will then pick up the book labelled p for donation.

Since Twilight is not good at mathematics, she asks you to write a program to calculate the answer of all bookcases. If the program is correct, Twilight will be happy and she may teach you some magic tricks.

Input

First line contains one integer T, representing the number of the bookcases.

The next T lines contains two integers x, n, representing the two numbers Spike gives to Twilight.

1 <= T <= 100

1 <= x <= 105

1 <= n <= 1000

Output

For each bookcase, please output a line contains one integer p, representing the label of the book that is donated.

Sample Input  Download

Sample Output  Download

Tags

prime



Discuss




11598 - Word rotation   

Description

    Given a string with length L < 1001 and only containing capital letters, lower letters and digits, please output the result of rotating the word for one time, and repeat doing so for L times.

    Suppose the original string is  ab1cde , after rotating for one time, the result will be  b1cdea. 

That is, the operator of rotating for one time is to move the first letter of the string to the tail of the string. 

 

Input

There is only one line in the input, which is a string only containing capital letters, lower letters and digits.

The length of the string L < 1001.

 

Output

    Output the result of rotating the word for one time, and repeat doing so for L times. The last line is the original string. Remember to print the endline character.

Sample Input  Download

Sample Output  Download

Tags




Discuss