Facebook
From Sweet Leopard, 2 Years ago, written in Plain Text.
This paste is a reply to Untitled from Subtle Mousedeer - go back
Embed
Viewing differences between Untitled and Re: Untitled
public class task
Task
{
        public static void main(String[] args) {
                int[] arr={10,7,2,5,2,20};
arr={3, 1, 2, 3, 6, 2, 3, 6, 2, 3};
                int maxheight=arr[0];
                int currheight=0;
                int width=0;
                for(int i=0;i                 {
                    width=width+arr[i];
                    if(i%2==0)
                    {
                        currheight=currheight+arr[i];
                    }
                    else
                    {
                        currheight=currheight-arr[i];
                    }
                    if(currheight>maxheight)
                    maxheight=currheight;
                }
                
}

                
                
char[][] result=new char[maxheight][width];
                
char[maxheight + 3][width + 1];
                
int x=maxheight-1,y=0;
x=maxheight-1 + 3, y=0;

                for(int i=0;i                 {
                    if(arr[i]%2==0)
if(i % 2==0) //////
                    {
                        for(int j=0;j                         {
                            result[x][y]='/';
                            x--;
                            y++;
                        }
                                if(x < result.length - maxheight){
                                        result[x][y - 1] = '<';
                                        result[x][y + 1] = '>';
                                        result[x - 1][y] = '|';
                                        result[x - 1][y - 1] = '/';
                                        result[x - 1][y + 1] = '\\';
                                        result[x - 2][y] = 'o';
                                        y++;
                                }
                        x++;
                        //y++;
                    }
                    else
                    {
                        for(int j=0;j                         {
                            result[x][y]='\\';
                            x++;
                            y++;
                        }
                        x--;
                        //y++;
                    }
                    
                }
                                
                
for(int i=0;i i=0;i                 {
                    for(int j=0;j j=0;j                     {
                        if(result[i][j]=='/' || result[i][j]=='\\')
if(result[i][j] != '\0')
                        System.out.print(result[i][j]);
                        else
                        System.out.print(" ");
                    }
                    System.out.println();
                }
        }
}