Algorithm

https://www.acmicpc.net/problem/8393 8393번: 합 n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오. www.acmicpc.net import java.util.Scanner; public class bj8393 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.close(); 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 bj10950 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0; i
https://www.acmicpc.net/problem/2739 2739번: 구구단 N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다. www.acmicpc.net import java.util.Scanner; public class bj2739 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); sc.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 bj2480 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); in.close(); if(a==b && ..
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 bj2525 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int h = in.nextInt(); int m = in.nextInt(); int n = in.nextInt(); // 모든 시간을 분으로 바꾼다! int a..
https://www.acmicpc.net/problem/2884 2884번: 알람 시계 상근이는 매일 아침 알람을 듣고 일어난다. 알람을 듣고 바로 일어나면 다행이겠지만, 항상 조금만 더 자려는 마음 때문에 매일 학교를 지각하고 있다. 상근이는 모든 방법을 동원해보았지만, www.acmicpc.net import java.util.Scanner; public class bj2884 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int H = in.nextInt();//시간 입력 int M = in.nextInt();//분 입력 in.close(); if(M
https://www.acmicpc.net/problem/14681 14681번: 사분면 고르기 점 (x, y)의 사분면 번호(1, 2, 3, 4 중 하나)를 출력한다. www.acmicpc.net import java.util.Scanner; public class bj14681 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int X = in.nextInt();// X 좌표 입력 int Y = in.nextInt();// Y 좌표 입력 if(X>0) { if(Y>0) { System.out.println(1); } else { System.out.println(4); } } else { if(Y>0) { ..
https://www.acmicpc.net/problem/2753 2753번: 윤년 연도가 주어졌을 때, 윤년이면 1, 아니면 0을 출력하는 프로그램을 작성하시오. 윤년은 연도가 4의 배수이면서, 100의 배수가 아닐 때 또는 400의 배수일 때이다. 예를 들어, 2012년은 4의 배수이면서 www.acmicpc.net import java.util.Scanner; public class bj2753{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); sc.close(); if(a % 4 == 0) { if(a % 100 != 0 || a % 400 == 0){ System.o..
po3nyo
'Algorithm' 카테고리의 글 목록