Created
April 4, 2023 16:08
-
-
Save ozuma/a9256d267212226b8beb9d028a40de4a to your computer and use it in GitHub Desktop.
ABC294_a: Java, STDIN, stream, Arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
final int arraySize = Integer.parseInt(sc.next()); | |
int[] lists = new int[arraySize]; | |
for (int i = 0; i < arraySize; i++) { | |
lists[i] = sc.nextInt(); | |
} | |
Arrays.stream(lists) | |
.filter(i -> i % 2 == 0) | |
.forEach(i -> System.out.println(i)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment