You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <bits/stdc++.h>
using namespace std ;
//https://www.luogu.com.cn/blog/froggy/solution-p1498
const int N = 3010 ; //开大点
char a [ N ] [ N ] ;
int n ;
int h = 2 , w = 4 ; //h是高,w是宽
void init ( ) {
memset ( a , ' ' , sizeof ( a ) ) ;
a [ 1 ] [ 2 ] = a [ 2 ] [ 1 ] = ' / ' ;
a [ 1 ] [ 3 ] = a [ 2 ] [ 4 ] = ' \\ ' ;
a [ 2 ] [ 2 ] = a [ 2 ] [ 3 ] = ' _ ' ;
}
int main ( ) {
//初始化
init ( ) ;
//读入
cin > > n ;
//迭代n-1次, 因为第一个三角形已经写死了~
for ( int i = 1 ; i < n ; i + + ) {
//向下和向右
for ( int j = 1 ; j < = h ; j + + ) {
for ( int k = 1 ; k < = w ; k + + ) {
a [ j + h ] [ k ] = a [ j + h ] [ k + w ] = a [ j ] [ k ] ;
a [ j ] [ k ] = ' ' ; //把上面的清掉
}
}
//向上
for ( int j = 1 ; j < = h ; j + + )
for ( int k = 1 ; k < = w ; k + + )
a [ j ] [ k + w / 2 ] = a [ j + h ] [ k ] ;
//双倍扩展
w * = 2 , h * = 2 ;
//刷新完成一次
}
//输出大吉
for ( int i = 1 ; i < = h ; i + + ) { //高度就是行
for ( int j = 1 ; j < = w ; j + + ) //宽度就是列
cout < < a [ i ] [ j ] ;
cout < < endl ;
}
return 0 ;
}