P1259 黑白棋子的移动
作者:互联网
// Problem: P1259 黑白棋子的移动
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1259
// Memory Limit: 128 MB
// Time Limit: 1000 ms
// User: Pannnn
#include <bits/stdc++.h>
using namespace std;
template<class T>
void debugVector(const T &a) {
cout << "[ ";
for (size_t i = 0; i < a.size(); ++i) {
cout << a[i] << (i == a.size() - 1 ? " " : ", ");
}
cout << "]" << endl;
}
template<class T>
void debugMatrix2(const T &a) {
for (size_t i = 0; i < a.size(); ++i) {
debugVector(a[i]);
}
}
template<class T>
using matrix2 = vector<vector<T>>;
template<class T>
vector<vector<T>> getMatrix2(size_t n, size_t m, T init = T()) {
return vector<vector<T>>(n, vector<T>(m, init));
}
template<class T>
using matrix3 = vector<vector<vector<T>>>;
template<class T>
vector<vector<vector<T>>> getMatrix3(size_t x, size_t y, size_t z, T init = T()) {
return vector<vector<vector<T>>>(x, vector<vector<T>>(y, vector<T>(z, init)));
}
vector<int> genBigInteger(string a) {
vector<int> res;
for (int i = a.size() - 1; i >= 0; --i) {
res.push_back(a[i] - '0');
}
return res;
}
void printBigInteger(vector<int> a) {
for (size_t i = a.size() - 1; i >= 0; --i) {
cout << a[i];
}
}
vector<int> addBigInteger(vector<int> a, vector<int> b) {
vector<int> res;
int pre = 0;
for (size_t i = 0; i < a.size() || i < b.size() || pre; ++i) {
if (i < a.size()) pre += a[i];
if (i < b.size()) pre += b[i];
res.push_back(pre % 10);
pre /= 10;
}
return res;
}
void printSuf(int n, int now) {
for (int i = 0; i < now - n; ++i) {
cout << "o*";
}
}
void move(int n, int now) {
if (n == 4) {
cout << "oooo****--";
printSuf(n, now);
cout << endl;
cout << "ooo--***o*";
printSuf(n, now);
cout << endl;
cout << "ooo*o**--*";
printSuf(n, now);
cout << endl;
cout << "o--*o**oo*";
printSuf(n, now);
cout << endl;
cout << "o*o*o*--o*";
printSuf(n, now);
cout << endl;
cout << "--o*o*o*o*";
printSuf(n, now);
cout << endl;
return;
}
for (int i = 0; i < n; ++i) {
cout << "o";
}
for (int i = 0; i < n; ++i) {
cout << "*";
}
cout << "--";
printSuf(n, now);
cout << endl;
--n;
for (int i = 0; i < n; ++i) {
cout << "o";
}
cout << "--";
for (int i = 0; i < n; ++i) {
cout << "*";
}
printSuf(n, now);
cout << endl;
move(n, now);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
move(n, n);
return 0;
}
标签:pre,return,int,res,黑白,P1259,vector,棋子,size 来源: https://www.cnblogs.com/pannnn/p/15961654.html