package 杨辉三角;
import java.util.Scanner;
public class yhsj {
public static void main(String args[]) {
Scanner in = new Scanner(System.in); // 获取控制台输入对象
SeqQueues = new SeqQueue();
s.enqueue(0);
s.enqueue(1);
System.out.print("请输入行号: ");
int n = in.nextInt();
int i = 0;
while (i <= n) {
int x = s.dequeue();
int y = s.frontqueue();
if (x == 0) {
i++;
s.enqueue(0);
}
s.enqueue(x + y);
if (x == 0)
System.out.println();
else
System.out.print(x + " ");
}
}
}
interface QQueue{
boolean isEmpty();
void enqueue(T x);
T dequeue();
}
class SeqQueueimplements QQueue{
private Object element[];
private int front, rear;
public SeqQueue(int length) {
if (length < 64)
length = 64;
this.element = new Object[Math.abs(length)];
this.front = this.rear = 0;
}
public SeqQueue() {
this(64); }