l1-002. Print an hourglass
The subject requires you to write a program that prints the given symbol in the shape of an hourglass. For example, given 17 "*", require printing in the following format
*****
***
*
***
*****
The so-called "hourglass shape" refers to the output of the odd number of symbols per line, the line symbol center alignment, the adjacent two lines of symbol number difference 2, the number of symbols from large to small order descending to 1, and then increasing in order from small to large, the number of the first sign is equal.
Given any n symbols, it is not necessarily possible to form an hourglass. Require that the printed hourglass can use as many symbols as possible.
Input Format:
The input gives 1 positive integers n (<=1000) and a symbol on one line, separated by a space in the middle.
output Format:
First print out the largest hourglass shape made up of a given symbol, and then output the number of symbols left unused in a single line.
Input Sample:
19 *
Output Sample:
*****
***
*
***
*****
2
Code: