Submission

Status:

PPPPP

Subtask/Task Score:

100/100

Score: 100

User: Whatthepoop

Problemset: หินงอก

Language: c

Time: 0.001 second

Submitted On: 2025-10-10 15:05:25

#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	int h[n];
	
	int max= -1e9, sum = 0;
	for(int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		if(h[i] > max) max = h[i];
		sum += h[i]*2;
	}
	
	int row = max, col = sum;
	char arr[row][col];
	
	for(int i = 0; i < row; i++){
		for(int j = 0; j < col; j++){
			arr[i][j] = ' ';
		}
	}
	
	int i = 0, j = 0;
	for(int x = 0; x < n; x++){
		int count = h[x]*2;
		while(count > 0){
			if(count > h[x]){
				arr[i++][j++] = '\\';
				count--;
				if(count == h[x]) i--;
			}
			else{
				arr[i--][j++] = '/';
				count--;
			}
		}
		i = 0;
	}
	
	for(int i = 0; i < row; i++){
		for(int j = 0; j < col; j++){
			printf("%c", arr[i][j]);
		}
		printf("\n");
	}
	
	return 0;
}