2436 - I2P(I)2021_Yang_lab8 Scoreboard

Time

2021/11/30 18:30:00 2021/11/30 20:45:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11253 String Left Shift
12072 Full permutation

11253 - String Left Shift   

Description

Given a string S, you are going to shift part of it.
Specifically, a shift on a string is to move all the characters left but the leftmost characters would be move to the rightmost.
For example, a shift on "abcd" would result in "bcda".

This problem ask you implement a function shift(char *start, char *end) that shift a substring of S starting from start to end.

1.      This problem involves three files.

  • function.h: Function definition of shift.
  • function.c: Function implementation of shift.
  • main.c: A driver program to test your implementation.

You will be provided with main.c and function.h, and asked to implement function.c.

  • 2.     For OJ submission:

            Step 1. Submit only your function.c into the submission block. (Please choose c compiler) 

    Step 2. Check the results and debug your program if necessary.

Input

The first line is a string S. (length of S<=20)
The second is a integer n. (n<=10)
The next n lines, each contains two integers l and r.(l<=r<=n)
This means that a shift on S[l]S[l+1]...S[r].
If the length of substring is one(l=r), then you should keep the string unchanged.
All these shift must be done in order.

 

Output

The result string after all n shift operations.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11253.c

Partial Judge Header

11253.h

Tags




Discuss




12072 - Full permutation   

Description

Given a string s, find out all the different permutations of s. (including s itself)

 

Input

Input consists of one line, containing a string s.

There will be only lowercase Latin characters in s.

Note that the characters in s might be duplicate!


The length of s is no more than 10.

Note:

There are 3 test cases for no duplicate input, and 3 for duplicate input!

 

Hint:

1. Use a visited array to record if a character of the string has been used.

2. At each subproblem, use a loop to check each character from the first to the last to see if it has been visited or can be used in the current place.

 

 

Output

Print out all possible permutations in alphabetical order, each in one line.

Note: remember to print a '\n' at the end of output.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss