是不是卡输出格式了/(ㄒoㄒ)/~~

黄一肯 发表于 3年前 · 关联问题 南蛮图腾

#include <bits/stdc++.h> #define endl '\n' #define pb push_back using namespace std; using ll = long long; using db = double; using pii = pair<int, int>; const int mod = 998244353; const int maxn = 2e3 + 10; char s[maxn][maxn]; void draw(int num, int x, int y) { // cout << num << ' ' << x << ' ' << y << endl; if (num != 1) { int t = (1 << (num - 1)); draw(num - 1, x, y); draw(num - 1, x + t, y - t); draw(num - 1, x + t, y + t); } else { s[x][y] = '\\'; s[x][y - 1] = '/'; s[x + 1][y - 2] = '/'; s[x + 1][y - 1] = s[x + 1][y] = '_'; s[x + 1][y + 1] = '\\'; return; } } int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int n, i, j; cin >> n; draw(n, 0, (1 << n)); for (i = 0; i < (1 << n); i++) { for (j = 0; j < (1 << (n + 1)); j++) { if (s[i][j] == '/' || s[i][j] == '_' || s[i][j] == '\\') cout << s[i][j]; else cout << ' '; } cout << endl; } return 0; }

洛谷A了

黄一肯 发表于 3年前

好吧是我数组开小了..

lr580 发表于 3年前

啊洛谷还能A……洛谷数据比我随便出的还要水?//逃