#include<iostream>
#include<vector>
using namespace std;
vector<int> a, b, temp;
int fun(vector<int> &temp)
{
int cnt = 1;
for (int i = 0; i < temp.size(); i++)
{
if (i == temp.size() - 1)
{
a.push_back(temp[i]);
b.push_back(cnt);
}
else if (temp[i] == temp[i + 1])
{
cnt++;
}
else if (temp[i] != temp[i + 1])
{
a.push_back(temp[i]);
b.push_back(cnt);
cnt = 1;
}
}
temp.clear();
for (int i = 0; i < a.size(); i++)
{
temp.push_back(a[i]);
temp.push_back(b[i]);
}
a.clear();
b.clear();
}
int main()
{
int c, n;
cin >> c >> n;
temp.push_back(c);
for (int i = 1; i < n; i++)
{
fun(temp);
}
for (int i = 0; i < temp.size(); i++)
{
cout << temp[i];
}
}
PAT甲级1140
猜你喜欢
转载自blog.csdn.net/NULLdream/article/details/82941502
今日推荐
周排行