본문 바로가기

백준19

백준 2884(java) : 알람 시계 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = sc.nextLine(); String[] time = input.split(" "); int hour = Integer.parseInt(time[0]); int minute = Integer.parseInt(time[1]); //h : 0~ 23, m = 0~59 if( minute =1) { hour -= 1; minute = minute + 60 - 45; } else if(hour < 1) { hour = hour + 24.. 2022. 10. 3.
백준 9498(java) : 시험 성적 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String test = sc.nextLine(); int score = Integer.parseInt(test); if(score >=90 ) { System.out.println("A"); } else if (score >=80) { System.out.println("B"); } else if (score >=70) { System.out.println("C"); } else if (score>=60) { System.out.println("D"); } else { System.o.. 2022. 10. 3.
백준 1330(java) : 두 수 비교하기 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] A = sc.nextLine().split(" "); int a = 0; int b = 0; a = Integer.parseInt(A[0]); b = Integer.parseInt(A[1]); if( a>b) { System.out.println(">"); } else if ( a 2022. 10. 3.
BaekJoon 백준 10818 : 최소, 최대 문제 풀이 과정 1. 입력 처리 2. Arrays.sort() 사용 시, 0 번째 인덱스 최솟값, N 인덱스 최댓값. * 입력 과정이 생각처럼 되지 않았음. 기존 쓰던 방식대로 nextLine() 을 통해, split("") 으로 나누려 했으나 이 사진처럼 배열이 전부 출력되지 않았음. → 입력 방식을 배워야 할 것 같아 검색 사용. for 문 내에 키보드 입력을 받으면서 배열에 저장이 가능하다. 참고 블로그 : https://st-lab.tistory.com/43 [백준] 10818번 : 최소, 최대 - JAVA [자바] https://www.acmicpc.net/problem/10818 10818번: 최소, 최대 첫째 줄에 정수의 개수 N (1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄에는 .. 2022. 9. 25.