题目链接
代码
#include<iostream>#include<stack>usingnamespacestd;
int main() {
char a[2] = {'S', 'B'};
int n, x;
stack<int> s;
cin >> n;
while(n != 0) {
s.push(n % 10);
n /= 10;
}
while(!s.empty()) {
for(int i=0; i < s.top(); i++) {
if(s.size() == 1) {
for(int j = 1; j <= s.top(); j++) cout << j;
break;
}
elsecout << a[s.size() - 2];
}
s.pop();
}
return0;
}

发布评论