#include<iostream>
#include<string>
using namespace std;
int main()
{
string str;
cin >> str;
int b = 9,t=0;
int arr[10] = {0,0}, index[11];
for (int i = 0; i < 11&&b>=0; i++)
{
if (str[i]-'0'== b)
{
arr[t] = b; t++;
b--; i = -1; continue;
}
if (i == 10)
{
b--; i = -1;
}
}
for (int i = 0; i < 11; i++)
{
for (int j = 0; j < t; j++)
if (str[i] - '0' == arr[j])
{
index[i] = j; continue;
}
}
cout << "int[] arr = new int[]{";
for (int i = 0; i < t; i++)
{
if (i != 0) cout << ',';
cout << arr[i];
}
cout << "};" << endl;
cout << "int[] index = new int[]{";
for (int i = 0;i < 11; i++)
{
if (i != 0) cout << ',';
cout << index[i];
}
cout << "};";
}
团体程序设计天梯赛 L1-027 出租
最新推荐文章于 2024-08-16 23:08:36 发布