import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); //케이스 개수 int num = sc.nextInt(); //학생 수 int[] people = new int[num]; //평균값 float[] avg = new float[num]; float[] result = new float[num]; for(int i=0; i
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] M = new int[N]; float[] result = new float[N]; int max = 0; for(int i=0; i max) { max = M[i]; } } float sum = 0; for(int i=0; i
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int result = N; int count = 0; while(true) { N = ((N % 10) * 10) + (((N / 10) + (N % 10)) % 10); count++; if(N == result) { System.out.println(count); break; } } } } 설명 위 문제는 두 자릿수의 각 자리의 숫자를 더한 뒤 주어진 수의 가장 오른쪽 자리 수와 앞에서 구한 합의 가장 오른쪽 자릿수를 이어 붙인 뒤 새로운 수를..
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int num = sc.nextInt(); ArrayList ar = new ArrayList(); for(int i=0; i
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for(int i=0; i
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for(int i=0; i
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); int num3 = sc.nextInt(); if(num1 == num2 && num2 == num3) { System.out.println(10000 + (num1*1000)); } else if(num1 == num2 && num1 != num3) { System.out.println(1000 + (num1*100)); } else if(num2 == num3 && num1 != num2) { ..
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int m = sc.nextInt(); int time = sc.nextInt(); int result_m = m + time; if((result_m / 60) > 0) { h += result_m/60; result_m = result_m%60; } if(h >= 24) h -= 24; System.out.println(h + " " + result_m); } } 설명 위 문제는 시작하는 h, m(시, 분)과 조리하는 데 걸리는 시간(time)..
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); // 시 int M = sc.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)); } } } 설명 위 문제는 Scanner를 통해 사용자에게 시, 분을 입력받고, 그 시간보다 ..
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.print(1); } else { System.out.print(4); } } else { if(Y > 0) { System.out.print(2); } else { System.out.print(3); } } } } 설명 사분면 고르기 문제는 Scanner를 이용해 사용자에게 x, y를 입력받은 뒤, x와 y를 조건문을 통해 양수인지 정수인지 판..