Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- string repeat(char s, int n) {
- string result;
- for (int i = 0; i < n; i++) {
- result += s;
- }
- return result;
- }
- int main() {
- int n;
- cin >> n;
- printf("%s%s%s\n", repeat('.', n).c_str(), repeat('#', n).c_str(), repeat('.', n).c_str());
- for (int i = 0; i < n - 1; i += 2) {
- printf("%s##%s#%s#%s##%s\n", repeat('.', n - i - 2).c_str(), repeat('.', i).c_str(), repeat('.', n - 2).c_str(), repeat('.', i).c_str(), repeat('.', n - i - 2).c_str());
- }
- for (int i = n - 3; i >= 0; i -= 2) {
- printf("%s##%s#%s#%s##%s\n", repeat('.', n - i - 2).c_str(), repeat('.', i).c_str(), repeat('.', n - 2).c_str(), repeat('.', i).c_str(), repeat('.', n - i - 2).c_str());
- }
- printf("%s%s%s\n", repeat('.', n).c_str(), repeat('#', n).c_str(), repeat('.', n).c_str());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement