본문 바로가기

휴지통665

백준 2884 import java.util.Scanner; public class Main2884 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int M = sc.nextInt(); M = M-45; if(M < 0){ M = 60+M; H--; } if(H 2021. 6. 29.
백준 2753 import java.util.Scanner; public class Main2753 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int year = sc.nextInt(); if(year%4 ==0 && year%100 != 0 || year %400 == 0){ System.out.println(1); }else{ System.out.println(0); } } } 윤년의 조건은 년도가 4의 배수이고, 100의 배수가 아니면된다. 또한 400의 배수이면 된다. 이 조건을 성립하게 하기위해 && , || 연산을 사용해 조건문을 걸었다. && 연산은 양쪽 값이 모두 true이어야 true을 반환하고, ||연.. 2021. 6. 29.
백준 2739 import java.util.Scanner; public class Main2739 { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int N = sc.nextInt(); int[] result = new int[9]; for(int i=1; i 2021. 6. 29.
백준 2588 import java.util.Scanner; public class Main2588 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); System.out.println(A*(B%100%10)); System.out.println(A*(B%100/10)); System.out.println(A*(B/100)); System.out.println(A*B); } } 123123 이번문제는 세자리 끼리 곱셈을 할 때 그 풀이과정을 나타내는 문제이다 . 123 456이 입력되었다고 가정하였을 떄 곱셈의 풀이과정은 123 * 4 + 123*5*.. 2021. 6. 29.
백준 15552 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main15552 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new Out.. 2021. 6. 29.
백준 14681 import java.util.Scanner; public class Main14681 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); if(x>0 && y>0){ System.out.println(1); }else if(x0){ System.out.println(2); }else if(x 2021. 6. 28.