- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int L;
cin >> L; cin.ignore();
int H;
cin >> H; cin.ignore();
string T;
getline(cin, T);
string alphabet[H];
for (int i = 0; i < H; i++) {
string ROW;
getline(cin, ROW);
//cerr<<ROW<<endl;
alphabet[i]=ROW;
//cerr<<alphabet[i]<<endl;
}
string answer[H];
for(int i=0;i<H;++i){
answer[i]=T;
for_each(answer[i].begin(), answer[i].end(), [](char& in){ in = ::toupper(in); });
replace(answer[i].begin(), answer[i].end(), ' ', '1');
replace(answer[i].begin(), answer[i].end(), ',', '1');
replace(answer[i].begin(), answer[i].end(), '.', '1');
replace(answer[i].begin(), answer[i].end(), '@', '1');
replace(answer[i].begin(), answer[i].end(), '!', '1');
//cerr<<answer[i]<<endl;
}
for(int i=0;i<H;++i){
while (answer[i].find("A") != string::npos)
answer[i].replace(answer[i].find("A"), 1,alphabet[i],0*L,L);
while (answer[i].find("B") != string::npos)
answer[i].replace(answer[i].find("B"), 1,alphabet[i],1*L,L);
while (answer[i].find("C") != string::npos)
answer[i].replace(answer[i].find("C"), 1,alphabet[i],2*L,L);
while (answer[i].find("D") != string::npos)
answer[i].replace(answer[i].find("D"), 1,alphabet[i],3*L,L);
while (answer[i].find("E") != string::npos)
answer[i].replace(answer[i].find("E"), 1,alphabet[i],4*L,L);
while (answer[i].find("F") != string::npos)
answer[i].replace(answer[i].find("F"), 1,alphabet[i],5*L,L);
while (answer[i].find("G") != string::npos)
answer[i].replace(answer[i].find("G"), 1,alphabet[i],6*L,L);
while (answer[i].find("H") != string::npos)
answer[i].replace(answer[i].find("H"), 1,alphabet[i],7*L,L);
while (answer[i].find("I") != string::npos)
answer[i].replace(answer[i].find("I"), 1,alphabet[i],8*L,L);
while (answer[i].find("J") != string::npos)
answer[i].replace(answer[i].find("J"), 1,alphabet[i],9*L,L);
while (answer[i].find("K") != string::npos)
answer[i].replace(answer[i].find("K"), 1,alphabet[i],10*L,L);
while (answer[i].find("L") != string::npos)
answer[i].replace(answer[i].find("L"), 1,alphabet[i],11*L,L);
while (answer[i].find("M") != string::npos)
answer[i].replace(answer[i].find("M"), 1,alphabet[i],12*L,L);
while (answer[i].find("N") != string::npos)
answer[i].replace(answer[i].find("N"), 1,alphabet[i],13*L,L);
while (answer[i].find("O") != string::npos)
answer[i].replace(answer[i].find("O"), 1,alphabet[i],14*L,L);
while (answer[i].find("P") != string::npos)
answer[i].replace(answer[i].find("P"), 1,alphabet[i],15*L,L);
while (answer[i].find("Q") != string::npos)
answer[i].replace(answer[i].find("Q"), 1,alphabet[i],16*L,L);
while (answer[i].find("R") != string::npos)
answer[i].replace(answer[i].find("R"), 1,alphabet[i],17*L,L);
while (answer[i].find("S") != string::npos)
answer[i].replace(answer[i].find("S"), 1,alphabet[i],18*L,L);
while (answer[i].find("T") != string::npos)
answer[i].replace(answer[i].find("T"), 1,alphabet[i],19*L,L);
while (answer[i].find("U") != string::npos)
answer[i].replace(answer[i].find("U"), 1,alphabet[i],20*L,L);
while (answer[i].find("V") != string::npos)
answer[i].replace(answer[i].find("V"), 1,alphabet[i],21*L,L);
while (answer[i].find("W") != string::npos)
answer[i].replace(answer[i].find("W"), 1,alphabet[i],22*L,L);
while (answer[i].find("X") != string::npos)
answer[i].replace(answer[i].find("X"), 1,alphabet[i],23*L,L);
while (answer[i].find("Y") != string::npos)
answer[i].replace(answer[i].find("Y"), 1,alphabet[i],24*L,L);
while (answer[i].find("Z") != string::npos)
answer[i].replace(answer[i].find("Z"), 1,alphabet[i],25*L,L);
while (answer[i].find("1") != string::npos)
answer[i].replace(answer[i].find("1"), 1,alphabet[i],26*L,L);
}
for(string x:answer) {
cout<<x<<endl;
}
}
решение задачи "считать алфавит, написанный в ASCII графике, и нарисовать этим же ASCII шрифтом текст"
Комментарии (2) RSS
Добавить комментарий