2127 - I2P(I)2020_Huang_lab4 Scoreboard

Time

2020/10/15 08:00:00 2020/10/15 12:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12915 Number Pyramid
12916 Reversed Number Pyramid Pattern

12915 - Number Pyramid   

Description

Write a program that asks the user to input a positive number n. The program should output a pyramid number.

Input

N, such that N belongs to set of positive integers.

For example:

5

Output

1
22
333
4444
55555

Sample Input  Download

Sample Output  Download

Tags




Discuss




12916 - Reversed Number Pyramid Pattern   

Description

Now let the user input an integer n, followed by a “pattern”, represented by another integer.
If  n==5 and if the pattern == 1, then your program should output:

55555
4444
333
22
1

If  n == 6 and if the pattern == 2, then your program should output:

654321
54321
4321
321
21
1

If the user inputs any pattern other than 1 or 2, then your program should output the following:

Unrecognized pattern!

 

 

Dont' forget \n !

Input

N, P, such that N belogs to the set of positive integers, and P belongs to set {1, 2}.

Output

N, N-1, N-2, ..., 1

N-1, N-2, ..., 1

N-2, N-3, ..., 1

....

1

or

N, N, N, ..., N

N, N, ..., N

N, N

N

or

Unrecognized pattern!

Sample Input  Download

Sample Output  Download

Tags




Discuss