题目描述
blablabla
样例
blablabla
算法1
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println();
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
LinkedList<LinkedList<Integer>> l = new LinkedList<>();
LinkedList<Integer> ls = new LinkedList<>();
for (int i = n; i > 0; i--) {
ls.addFirst(i);
l.add(new LinkedList<>(ls));
for (int j = 0; j < l.size(); j++) {
if (l.get(j).peek() == i)
break;
LinkedList<Integer> t = new LinkedList<>(l.get(j));
t.addFirst(i);
l.add(t);
}
for (LinkedList<Integer> li : l
) {
if (li.peek() == i) {
for (int y : li
) {
System.out.print(y + " ");
}
System.out.println();
}
}
ls.clear();
}
}
}