#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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.