C. A Mist of Florescence
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
As the boat drifts down the river, a wood full of blossoms shows up on the riverfront.
"I've been here once," Mino exclaims with delight, "it's breathtakingly amazing."
"What is it like?"
"Look, Kanno, you've got your paintbrush, and I've got my words. Have a try, shall we?"
There are four kinds of flowers in the wood, Amaranths, Begonias, Centaureas and Dianthuses.
The wood can be represented by a rectangular grid of nn rows and mm
According to Mino, the numbers of connected components formed by each kind of flowers are aa, bb, cc and dd
You are to help Kanno depict such a grid of flowers, with nn and mm
Note that you can choose arbitrary nn and mm
Input
The first and only line of input contains four space-separated integers aa, bb, cc and dd (1≤a,b,c,d≤1001≤a,b,c,d≤100) — the required number of connected components of Amaranths, Begonias, Centaureas and Dianthuses, respectively.
Output
In the first line, output two space-separated integers nn and mm (1≤n,m≤501≤n,m≤50) — the number of rows and the number of columns in the grid respectively.
Then output nn lines each consisting of mm consecutive English letters, representing one row of the grid. Each letter should be among 'A', 'B', 'C' and 'D', representing Amaranths, Begonias, Centaureas and Dianthuses, respectively.
In case there are multiple solutions, print any. You can output each letter in either case (upper or lower).
Examples
Copy
5 3 2 1
Copy
4 7 DDDDDDD DABACAD DBABACD DDDDDDD
Copy
50 50 1 1
Copy
4 50 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC ABABABABABABABABABABABABABABABABABABABABABABABABAB BABABABABABABABABABABABABABABABABABABABABABABABABA DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Copy
1 6 4 5
Copy
7 7 DDDDDDD DDDBDBD DDCDCDD DBDADBD DDCDCDD DBDBDDD DDDDDDD
Note
In the first example, each cell of Amaranths, Begonias and Centaureas forms a connected component, while all the Dianthuses form one.
题目大概:
给你a b c d四个字母的联通分量数,然后,让你在一个最大50*50的矩形内实现这种连通。只有相同颜色的挨着,才算连通。输出连通的图的样子。
思路:
我的思路麻烦了,是按照给的数字的大小,定好图的大小,然后再差不多按照例子的格式填充。但是这种题,根本不需判断,直接填充满50*50就好。
代码: