[백준][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_..
[백준][Java] 2753 - 윤년
2023. 7. 6. 00:02
백준/Java
https://www.acmicpc.net/problem/2753 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int year = 0; year = scanner.nextInt(); if ((year % 4 == 0) && (year % 100 != 0)) { System.out.println(1); } else if (year % 400 == 0) { System.out.println(1); } else { System.out.println(0); } } } HTML 삽입 미리보기할 수 없는 소스 일단 사용자의 입력을 ..
[백준][Java] 14681 - 사분면 고르기
2023. 7. 4. 22:51
백준/Java
https://www.acmicpc.net/problem/14681 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); if ((x > 1) && (y > 1)) { System.out.print("1"); } else if ((x 1)) { System.out.print("2"); } else if ((x 1) && (y < 1)) ..