3 条题解
-
1
#include <iostream> #include <cstdio> #include <iomanip> #include <cmath> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <queue> #include <bits/stdc++.h> #define LL long long using namespace std; const int INF = 0x3f3f3f3f; const int N = 1e5 + 10; char a[1050][2050]; void f(int x, int y, int n) { if(n == 1) { for(int i = x; i < x + 4; i++) { int l = y + 4 - (i - x); int r = y + 4 + (i - x); for(int j = l; j <= r; j+=2) { a[i][j] = '*'; } } return; } f(x , pow(2,n) + y , n - 1); f(x + pow(2,n) , y , n - 1); f(x + pow(2,n) , y + pow(2,n+1) , n - 1); } int main() { int n; cin >> n; memset(a , ' ' , sizeof(a)); f(0,0,n); for(int i = 0; i < pow(2,n+1); i++) { for(int j = 1; j < pow(2,n+2); j++) { printf("%c",a[i][j]); } printf("\n"); } return 0; }
信息
- ID
- 1241
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 4
- 标签
- 递交数
- 101
- 已通过
- 44
- 上传者