https://www.hackerrank.com/challenges/java-1d-array-introduction/problem?isFullScreen=true
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++){
a[i] = scan.nextInt();
}
scan.close();
// Prints each sequential element in array a
for (int i = 0; i < a.length; i++) {
System.out.println(a[i]);
}
}
}
반응형
'HackerRank > JAVA' 카테고리의 다른 글
Java BigInteger (0) | 2024.01.22 |
---|---|
Java Exception Handling (Try-catch) (0) | 2024.01.22 |
Java Primality Test (0) | 2024.01.22 |
Valid Username Regular Expression (0) | 2024.01.19 |
[작성중]Java Regex 2 - Duplicate Words (0) | 2024.01.19 |