Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: mister_o_hater_no1
Problemset: ห่วงโซ่ (Chain)
Language: cpp
Time: 0.006 second
Submitted On: 2025-10-15 19:58:47
#include <bits/stdc++.h>
using namespace std;
vector<string> chain;
int height;
int l;
void initial() {
string temp((2* height- 1)* l+ 2, '.');
for (int i= 0; i<= 2* height; ++i) {
chain.push_back(temp);
}
}
void convert(int start, char c) {
for (int i= 0; i< 2* height+ 1; ++i) {
for (int j= 0; j< 2* height+ 1; ++j) {
if (i+ j== height || j- i== height || i- j== height || i+ j== 3* height) {
chain[i][j+ start]= c;
}
}
}
}
void print(){
for (int i= 0; i< chain.size(); ++i) {
cout<< chain[i]<< '\n';
}
cout<< '\n';
}
int main() {
cin.tie(nullptr)->sync_with_stdio(0);
string word;cin>> word>> height;
l= word.length();
initial();
for (int i= 0; i< word.length(); ++i) {
int start= i* (2* height- 1);
convert(start, word[i]);
}
print();
return 0;
}