P1259 黑白棋子的移动
2022/3/3 23:17:57
本文主要是介绍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; }
这篇关于P1259 黑白棋子的移动的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-26结对编程到底难不难?答案在这里
- 2024-06-19《2023版Java工程师》课程升级公告
- 2024-06-15matplotlib作图不显示3D图,怎么办?
- 2024-06-1503-Loki 日志监控
- 2024-06-1504-让LLM理解知识 -Prompt
- 2024-06-05做软件测试需要懂代码吗?
- 2024-06-0514-ShardingSphere的分布式主键实现
- 2024-06-03为什么以及如何要进行架构设计权衡?
- 2024-05-31全网首发第二弹!软考2024年5月《软件设计师》真题+解析+答案!(11-20题)
- 2024-05-31全网首发!软考2024年5月《软件设计师》真题+解析+答案!(21-30题)