Submission
Status:
[-SSSSSSSS]
Score: 0
User: Nathlol2
Problemset: ภูเขา
Language: c
Time: 0.006 second
Submitted On: 2024-10-11 12:37:49
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int pupa[n];
int sum[n];
int mx = -1;
for(int i = 0;i<n;i++){
scanf("%d", &pupa[i]);
if(mx < pupa[i]){
mx = pupa[i];
}
if(i == 0){
sum[i] = pupa[i] * 2;
}else {
sum[i] = sum[i - 1] + (pupa[i] * 2);
}
}
char hin[mx][sum[n - 1]];
for(int i = 0;i<mx;i++){
for(int z = 0;z<sum[n - 1];z++){
hin[i][z] = ' ';
}
}
int high = mx - 1;
int core = 0;
for(int i = 0;i<n;i++){
if(i == 0){
while(core < sum[i]){
if(core < (sum[i] / 2) - 1){
hin[high][core] = '/';
high--;
}else if(core == (sum[i] / 2) - 1){
hin[high][core] = '/';
}else if(core > (sum[i] / 2) - 1){
hin[high][core] = '\\';
high++;
}
if(core == sum[i] - 1){
high--;
}
core++;
}
}else {
while(core < sum[i]){
if(core < sum[i - 1] + pupa[i] - 1){
hin[high][core] = '/';
high--;
}else if(core == sum[i - 1] + pupa[i] - 1){
hin[high][core] = '/';
}else if(core > sum[i - 1] + pupa[i] - 1){
hin[high][core] = '\\';
high++;
}
if(core == sum[i] - 1){
high--;
}
core++;
}
}
}
for(int i = 0;i<mx;i++){
for(int z = 0;z<sum[n - 1];z++){
printf("%c", hin[i][z]);
}
printf("\n");
}
}