解析:这道题我最开始读题有问题,后来重新做,耐心没了,借鉴了别人的转天才重新做好。思路是这样的,我们将数据存入数组A,新建一个0-9的数组B,遍历一遍1-9的数组A,索引位上不为零就输出一遍数组B对应索引的数,然后数组A索引位减减,这是输出1-9的数,首位不能为0所以我们要再处理,因为我么数组B就是按照升序,所以我们首字母可以在数组A第二索引数遍历一遍后输出,知道A的0索引位为0。
public class Pta_1023 {
public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
String[] str = buf.readLine().split(" ");
int[] arr0 = new int[10];//存输入
int[] arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
for (int i = 0; i < str.length; i++) {
arr0[i] = (Integer.valueOf(str[i]));
}
boolean istre = true;
for (int i = 1; i < arr0.length; i++) {
if (arr0[i] != 0) {
System.out.print(arr[i]);//输出0之后的
while (arr0[0] != 0) {//输出0
System.out.print(arr[0]);
arr0[0]--;
}
arr0[i]--;
i--;
}
}
}
}