public class LinkList ... { class Node...{ int id; Node next; }; Node[] aList; LinkList()...{} LinkList(int N)...{ int i; aList = new Node[N]; aList[0] = new Node(); aList[0].id = 1; for(i = 1; i < N-1; i++)...{ aList[i] = new Node(); aList[i].id = i+1; aList[i-1].next = aList[i]; } aList[i] = new Node(); aList[i].id = i+1; aList[i].next = null; } public static void main(String[] args)...{ int N = 7; LinkList LL = new LinkList(N); int i = 0, j = 0; while(LL.aList[j].next != null)...{ i++; j += 2; } if(N%2 == 0)//偶数时取中间两个 System.out.println(LL.aList[i].id + " " + LL.aList[i+1].id); else//奇数时只取中间一个 System.out.println(LL.aList[i].id); }}