blob: 61a8502c7a2f08f347cfc84e2e995756d86d3b6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* vim: set expandtab tabstop=4 shiftwidth=4 : */
public class Subset
{
public static void main(String[] args)
{
int k = Integer.parseInt(args[0]);
if (k == 0) return;
RandomizedQueue<String> q = new RandomizedQueue<String>();
while (!StdIn.isEmpty())
{
q.enqueue(StdIn.readString());
}
for (int i = 0; i < k; i++)
System.out.println(q.dequeue());
System.out.println();
}
}
|