취업준비 - 코테 , 면접/알고리즘(코테) 공부 (104) 썸네일형 리스트형 백준 2739번(반복문) (풀이) import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); int c = in.nextInt(); int arr[] = new int[c]; for (int i = 0; i < c; i++) { int a = in.nextInt(); int b = in.nextInt(); arr[i] = a + b; } for (int k : arr) { System.out.println(k); } } } 알고리즘 입문(Java) - String - 6.중복문자제거 (풀이) import java.util.*; class Main { public String solution(String str){ String answer=""; for(int i=0; i 백준 2480번 (조건문) (풀이) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a, b, c; a = in.nextInt(); b = in.nextInt(); c = in.nextInt(); // 만약 모든 변수가 다른 경우 if (a != b && b != c && a != c) { int max; // 만약 a > b 라면 if (a > b) { // c > a > b 라면 if (c > a) { max = c; } // a > (b, c) else { max = a; } } // b > a 라면 else { // c > b > a 라면 if .. 백준 2525번 (조건문) (풀이) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); int C = in.nextInt(); int min = 60 * A + B; // 시 -> 분 min += C; int hour = (min / 60) % 24; int minute = min % 60; System.out.println(hour + " " + minute); } } 백준 2884번 (조건문) (풀이) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int H = in.nextInt(); // 시 int M = in.nextInt(); // 분 if(M < 45) { H--; // 시(hour) 1 감소 M= 60 - (45 - M); // 분(min) 감소 if(H < 0) { H = 23; } System.out.println(H + " " + M); } else { System.out.println(H + " " + (M - 45)); } } } 백준 14681번 (조건문) (문제) (풀이) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); if(x > 0) { if(y > 0) { System.out.println(1); } else { // (y 0) { System.out.println(2); } else { // (y < 0) System.out.println(3); } } } } 백준 2753번 (조건문) 풀이) import java.util.*; class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int A = sc.nextInt(); if(A%400==0){ System.out.println("1"); } else if(A%100==0){ System.out.println("0"); } else if(A%4==0){ System.out.println("1"); } else{ System.out.println("0"); } } } 알고리즘 입문(Java) - String - 5.특정문자 뒤집기 풀이) 이전 1 ··· 9 10 11 12 13 다음