更新
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import java.util.*;
|
||||
|
||||
public class P1098 {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
List<Integer> a = new ArrayList<>();
|
||||
while (in.hasNextInt()) a.add(in.nextInt());
|
||||
StringBuilder first = new StringBuilder();
|
||||
StringBuilder second = new StringBuilder();
|
||||
boolean f = true;
|
||||
for (int i = 0; i < a.size(); i++) {
|
||||
if ((i & 1) == 0) {
|
||||
if (!f) first.append(' ');
|
||||
first.append(a.get(i));
|
||||
f = false;
|
||||
} else {
|
||||
if (second.length() > 0) second.append(' ');
|
||||
second.append(a.get(i));
|
||||
}
|
||||
}
|
||||
System.out.println(first.toString());
|
||||
System.out.println(second.toString());
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 MiB |
Reference in New Issue
Block a user