문제 https://www.acmicpc.net/problem/25304 25304번: 영수증 준원이는 저번 주에 살면서 처음으로 코스트코를 가 봤다. 정말 멋졌다. 그런데, 몇 개 담지도 않았는데 수상하게 높은 금액이 나오는 것이다! 준원이는 영수증을 보면서 정확하게 계산된 것 www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int X = scan.nextInt(); int N = scan.nextInt(); int a, b = 0; int sum = 0; for (int i = 1; i
문제 https://www.acmicpc.net/problem/10950 10950번: A+B - 3 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int testcase = scan.nextInt(); for (int i = 1; i
문제 https://www.acmicpc.net/problem/2739 2739번: 구구단 N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다. www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan.close(); for (int i = 1; i
문제 https://www.acmicpc.net/problem/2480 2480번: 주사위 세개 1에서부터 6까지의 눈을 가진 3개의 주사위를 던져서 다음과 같은 규칙에 따라 상금을 받는 게임이 있다. 같은 눈이 3개가 나오면 10,000원+(같은 눈)×1,000원의 상금을 받게 된다. 같은 눈이 2개 www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int dice1 = scan.nextInt(); int dice2 = scan.nextInt(); int dice3 = scan.nextInt();..
문제 https://www.acmicpc.net/problem/2525 2525번: 오븐 시계 첫째 줄에 종료되는 시각의 시와 분을 공백을 사이에 두고 출력한다. (단, 시는 0부터 23까지의 정수, 분은 0부터 59까지의 정수이다. 디지털 시계는 23시 59분에서 1분이 지나면 0시 0분이 된다.) www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int H = scan.nextInt(); int M = scan.nextInt(); int requireTime = scan.nextInt(); sc..
문제 https://www.acmicpc.net/problem/2884 2884번: 알람 시계 상근이는 매일 아침 알람을 듣고 일어난다. 알람을 듣고 바로 일어나면 다행이겠지만, 항상 조금만 더 자려는 마음 때문에 매일 학교를 지각하고 있다. 상근이는 모든 방법을 동원해보았지만, www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int H = scan.nextInt(); int M = scan.nextInt(); scan.close(); int newH = H; int newM = M - 45; i..
문제 https://www.acmicpc.net/problem/14681 14681번: 사분면 고르기 점 (x, y)의 사분면 번호(1, 2, 3, 4 중 하나)를 출력한다. www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); int y = scan.nextInt(); scan.close(); if (x > 0 && y > 0) { System.out.println("1"); } else if (x 0) { System.out.printl..
문제 https://www.acmicpc.net/problem/2753 2753번: 윤년 연도가 주어졌을 때, 윤년이면 1, 아니면 0을 출력하는 프로그램을 작성하시오. 윤년은 연도가 4의 배수이면서, 100의 배수가 아닐 때 또는 400의 배수일 때이다. 예를 들어, 2012년은 4의 배수이면서 www.acmicpc.net 풀이 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int year = scan.nextInt(); scan.close(); boolean isLeapYear = (year % 4 == 0) && (year..