Input Specification
There are more test cases. Each case starts with a line contai
ning two integers
M
,
N
separated
by space (1
≤
M
≤
100, 1
≤
N
≤
10
5
). Next, there are
N
lines, each line contains a triple of
integers
S
,
X
,
Y
, separated by spaces, which describe one standing tree or on
e tree stump. The
values of
X
and
Y
represent the coordinates of the center of either tree roots
or a tree stump.
In case of
S
= 0 the triple describes a stump. In case of
S >
0 the triple describes a standing
tree with height
S
. It holds 0
≤
S
≤
9
,
−
10
9
≤
X, Y
≤
10
9
.
It is guaranteed that no parts of two different standing trees a
nd/or tree stumps should be
depicted by the same pixel.
Output Specification
For each test case, print the canvas with the image of the glad
e. The top row of the canvas
should be the first printed row of the image. The bottom row of t
he canvas should be the
last printed row of the image. The printout should be decorat
ed by a square border made of
asterisk characters (“
*
”, ASCII code 42), the thickness of the border should be one pi
xel. The
border should frame the canvas tightly, that is, there shoul
d be no spaces between the border
and canvas neither horizontally nor vertically. Print one e
mpty line after each case.
Sample Input
3 2
0 5 5
9 1 0
8 10
3 3 2
0 2 1
1 -1 -1
0 -1 2
3 0 6
6 4 7
0 7 4
3 8 -1
5 5 -5
9 2 -10
Output for Sample Input
*****
*/|*
*/|*
*_|_*
*****
**********
*|._|_..*
*|_.^....*
*../|...*
*../|._o*
*../|...*
*_._|_../*
*._o_.^./*
*.^./|/*
**********
AC代码
Select Code
#include
#include
using namespace std;
int mp[120][120], m;
int p(int x, int y)
{
if(x>=0&&x=0&&y=0; i--)
{
printf("*");
for(j = 0; j