题解
2024-07-24 09:42:41
发布于:广东
7阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
string d;
cin >> d;
cout << d[0];
for (int i=1;i<d.size()-1;i++){
if (d[i] == '-'){
if (d[i-1] < d[i+1] && ((abs(d[i-1] - d[i+1]) < 10 && isdigit(d[i-1])) || (abs(d[i-1] - d[i+1]) < 26 && islower(d[i-1])))){
if (isdigit(d[i-1]) && isdigit(d[i+1])){
if (a != 3){
if (c == 1){
for (int j=1;j<d[i+1]-d[i-1];j++){
for (int k=0;k<b;k++)
cout << char(d[i-1]+j);
}
}else{
for (int j=d[i+1]-d[i-1]-1;j>0;j--){
for (int k=0;k<b;k++)
cout << char(d[i-1]+j);
}
}
}else{
for (int j=1;j<d[i+1]-d[i-1];j++){
for (int k=0;k<b;k++)
cout << '*';
}
}
}else if(islower(d[i-1]) && islower(d[i+1])){
if (a == 1){
if (c == 1){
for (int j=1;j<d[i+1]-d[i-1];j++){
for (int k=0;k<b;k++)
cout << char(d[i-1]+j);
}
}else{
for (int j=d[i+1]-d[i-1]-1;j>0;j--){
for (int k=0;k<b;k++)
cout << char(d[i-1]+j);
}
}
}else if(a == 2){
if (c == 1){
for (int j=1;j<d[i+1]-d[i-1];j++){
for (int k=0;k<b;k++)
cout << char(d[i-1]+j-32);
}
}else{
for (int j=(d[i+1]-d[i-1])-1;j>0;j--){
for (int k=0;k<b;k++)
cout << char(d[i-1]+j-32);
}
}
}else{
for (int j=1;j<(d[i+1]-d[i-1]);j++){
for (int k=0;k<b;k++)
cout << '*';
}
}
}
}else cout << d[i];
}else cout << d[i];
}cout << d[d.size()-1];
return 0;
}
这里空空如也
有帮助,赞一个