본문 바로가기

코딩테스트/백준54

Java - 백준 코딩테스트 9498번 [if문 - 시험 성적] 12345678910111213141516171819202122232425262728293031import java.util.Scanner; public class TestScores { public static void main(String[] args) { // 20210611 - 9498번 Scanner sc = new Scanner(System.in); int score = sc.nextInt(); //while문으로 입력값 유효성 검사 while (score >= 0 && score = 90) { System.out.println("A"); break; } else if (score >= 80) { System.out.println("B"); break; } else if (score >= 70.. 2021. 6. 24.
Java - 백준 코딩테스트 2753번 [if문 - 윤년] 12345678910111213141516171819202122232425import java.util.Scanner; public class LeapYear { public static void main(String[] args) { // 20210611 - 2753번 //윤년이면 1, 아니면 0 출력 //윤년 : 연도가 4의 배수이면서 100의 배수가 아닐 때 또는 400배수일 때 //입력값 : 1보다 크거나 같고, 4000보다 작거나 같은 자연수 Scanner sc = new Scanner(System.in); int year = sc.nextInt(); int leapYear = 0; while (year >= 1 && year 2021. 6. 24.
Java - 백준 코딩테스트 14681번 [if문 - 사분면 고르기] 12345678910111213141516171819202122232425262728293031323334353637383940414243444546import java.util.Scanner; public class Quadrant { public static void main(String[] args) { // 20210611 - 14681번 Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int quadrantNum = 0; while ((x >= -1000 && x = -1000 && y 0 && y > 0) { quadrantNum = 1; break; } else if (x 0) { quadrant.. 2021. 6. 24.
Java - 백준 코딩테스트 2884번 [if문 - 알람 시계] 12345678910111213141516171819202122232425262728293031import java.util.Scanner; public class Alarm { public static void main(String[] args) { //20210614 - 2884번 Scanner sc = new Scanner(System.in); int hour = sc.nextInt(); int minute = sc.nextInt(); while (hour >= 0 && hour = 0 && minute 2021. 6. 24.
Java - 백준 코딩테스트 2739번 [for문 - 구구단] 123456789101112131415import java.util.Scanner; public class MultiTable { public static void main(String[] args) { //20210614 - 2739번 Scanner sc = new Scanner(System.in); int num = sc.nextInt(); for (int i = 1; i 2021. 6. 24.
Java - 백준 코딩테스트 10950번 [for문 - A + B - 3] 1234567891011121314151617import java.util.Scanner; public class AplusB { public static void main(String[] args) { //20210614 - 10950번 Scanner sc = new Scanner(System.in); int times = sc.nextInt(); for (int i = 0; i 2021. 6. 24.