CiscoOA #31
Delete Nodes Greater Than X
估计简单可在线判题
考点(AI 标注)链表
The node values of a singly linked list are given in their original order. Delete every node whose value is greater than x and output the remaining nodes without changing their order; nodes equal to x are kept.
输入格式
The input is n x, followed by n node values. The original bounds are kept: 1≤n≤100000, 1≤x≤100000, and node values in 1..100000.
输出格式
Output the remaining node values in their original order, separated by spaces; if all nodes are deleted, output an empty line. Do not output the number of nodes.
样例 1
输入:
4 3
1 5 3 4
输出:
1 3
样例 2
输入:
2 5
5 5
输出:
5 5
样例 3
输入:
2 1
2 3
输出:
样例说明
The outputs of the three public examples are, in order: 1 3; 5 5; empty text. Verified by independent enumeration or direct simulation.