Run ID:28097

提交时间:2022-06-12 20:19:57

#include <iostream> #include <cstring> using namespace std; bool check(char a , char b) { if( (a >= 'a' && a <= 'z') && (b >= 'a' && b <= 'z') && a < b ) return true ; else if( (a >= '0' && a <= '9') && (b >= '0' && b <= '9') && a < b ) return true ; return false ; } int main() { int p1 , p2 , p3 ; string str ; cin >> p1 >> p2 >> p3 ; cin >> str ; for(int i = 0 ; i < str.length() ; i++) { cout << str[i]; if( str[i + 1] == '-' && check(str[i],str[i+2]) ) { if(p1 == 1) { if(p3 == 1) for(char j = str[i] + 1 ; j < str[i+2] ; j++) for(int k = 0 ; k < p2 ; k++) cout << j ; else if(p3 == 2) for(char j = str[i+2] - 1 ; j > str[i] ; j--) for(int k = 0 ; k < p2 ; k++) cout << j ; } else if(p1 == 2) { if(p3 == 1) for(char j = str[i] + 1 ; j < str[i+2] ; j++) for(int k = 0 ; k < p2 ; k++) if(j >= '0' && j <= '9') cout << j; else cout << char(j - 32) ; else if(p3 == 2) for(char j = str[i+2] - 1 ; j > str[i] ; j--) for(int k = 0 ; k < p2 ; k++) if(j >= '0' && j <= '9') cout << j; else cout << char(j-32) ; } else if(p1 == 3) { for(char j = str[i] + 1 ; j < str[i+2] ; j++) for(int k = 0 ; k < p2 ; k++) cout << '*' ; } i++; } } return 0 ; }