취업준비 - 코테 , 면접/알고리즘(코테) 공부 (106) 썸네일형 리스트형 백준 25304번 (반복문) (풀이) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int X = sc.nextInt(); // 영수증에 적힌 총 금액 int N = sc.nextInt(); // 종류의 수 int total = 0; for(int i = 0; i < N; i++){ int a = sc.nextInt(); // 각 물건의 가격 int b = sc.nextInt(); // 각 물건의 개수 total += a * b; } if(total == X){ System.out.println("Yes"); }else{ System.out.println("N.. 백준 8393번(반복문) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); in.close(); int sum = 0; for (int i = 1; i 백준 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); } } } } 이전 1 ··· 9 10 11 12 13 14 다음