λ°μν
μ½λ
import java.util.Scanner;
import java.util.stream.IntStream;
public class κ°λ¨νNμμ½μ_1933 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
IntStream.rangeClosed(1, N).filter(i -> (N%i == 0)).forEach(i -> System.out.print(i + " "));
scan.close();
}
}
νμ΄
rangeClose(1, N)
- 1 ~ NκΉμ§
filter(i -> (N%i == 0)
- N%i == 0μΈκ²½μ°(iκ° Nμ μ½μμΈκ²½μ°)
forEach()
- μ½μμΈ i μΆλ ₯.
λ°μν
'Algorithm' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[Programmers] - λ κ° λ½μμ λνκΈ° (0) | 2020.09.20 |
---|---|
[SW Expert Academy] - (D2)1974. μ€λμΏ κ²μ¦ (0) | 2020.08.10 |
[SW Expert Academy] - (D1)2019. λλΈλλΈ(Stream) (0) | 2020.08.08 |
[SW Expert Academy] - (D1)2071. νκ· κ° κ΅¬νκΈ°(Stream) (0) | 2020.08.06 |
[SW Expert Academy] - (D1)2072. νμλ§ λνκΈ°(Stream) (4) | 2020.08.05 |
λκΈ