[백준][Java] 10871 - X보다 작은 수
2023. 7. 20. 00:57
백준/Java
https://www.acmicpc.net/problem/10871 import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int X = scanner.nextInt(); int[] numArr = new int[N]; for (int loop = 0; loop < N; loop++) { numArr[loop] = scanner.nextInt(); if (numArr[loop] < X) { System.out.println(numArr[loop]); }..
[백준][Java] 10952 - A+B - 5
2023. 7. 11. 22:56
백준/Java
https://www.acmicpc.net/problem/10952 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numA = 0; int numB = 0; while (scanner.hasNext()) { numA = scanner.nextInt(); numB = scanner.nextInt(); if (numA > 0 && numB < 10) { System.out.println(numA + numB); } else if (numA == 0 && numB == 0) { break; } } scanner.close..
[백준][Java] 10951 - A+B - 4
2023. 7. 10. 10:53
백준/Java
https://www.acmicpc.net/problem/10951 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numA = 0; int numB = 0; while (scanner.hasNextInt()) { numA = scanner.nextInt(); numB = scanner.nextInt(); System.out.println(numA + numB); } scanner.close(); } } Scanner scanner = new Scanner(System.in); int numA = 0; int numB..
[백준][Java] 10950 - A+B - 3
2023. 7. 10. 10:30
백준/Java
https://www.acmicpc.net/problem/10950 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int count = scanner.nextInt(); int numA = 0; int numB = 0; for (int numInput = 0; numInput < count; numInput++) { numA = scanner.nextInt(); numB = scanner.nextInt(); System.out.println(numA + numB); } } } Scanner scanner = new Scan..
[백준][Java] 10872 - 팩토리얼
2023. 7. 6. 23:51
백준/Java
https://www.acmicpc.net/problem/10872 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int userNum = scanner.nextInt(); scanner.close(); int factSum = factorial(userNum); System.out.println(factSum); } public static int factorial (int factNum) { if (factNum HTML 삽입 미리보기할 수 없는 소스 public static int factorial (int fact_..