public class Kata { public static int rentalCarCost(int d) { if(d > 0){ if(d > 0 && d =3 && d = 7) return (d * 40) - 50; } return d; } }
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int year = Integer.parseInt(br.readLine()); System.out.print((year % 4==0)?((year % 400==0)?"1":(year % 100==0)?"0":"1"):"0"); } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int x = Integer.parseInt(br.readLine()); int y = Integer.parseInt(br.readLine()); if(x > 0) { if(y > 0) { System.out.print(1); } else { System.out.prin..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); int score = Integer.parseInt(str); System.out.println((score >= 90)?"A" : (score >= 80)?"B" : (score >= 70)?"C" : (score >= ..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] str = br.readLine().split(" "); int A = Integer.parseInt(str[0]); int B = Integer.parseInt(str[1]); if(A > B){ System.out.println(">"); } else..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int arr[] = new int[9]; int max = arr[0]; // 최댓값을 담기 int index = 0; // 최댓값의 위치 담기 for (int i = 0; i < arr.length; i++) { arr[i] = Integer.parseInt(br.re..
import java.util.Scanner; public class BJ1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] array = new int[n]; int num = 0; for(int i = 0; i < n; i++) { array[i] = sc.nextInt(); } int v= sc.nextInt(); for(int i = 0; i < array.length; i++) { if (v == array[i]){ num++; } } System.out.println(num); } } 입력 받을 땐 BufferedReader를 사용해야 하는데 익숙하지..
2023-04-05 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class array1 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int A = Integer.parseInt(br.readLine()); //int 입력 받음 int B = Integer.parseInt(br.readLine()); int C = Integer.parseInt(br.readLine()); int..
23. 02. 09 1. 문자열을 순서대로 배열하기. 단, 문자와 문자 사이에 띄어쓰기가 들어가야하며 마지막 문자 뒤에는 띄어쓰기가 없어야 함. 풀이 1 public class Ex { public static void main(String[] args) { System.out.println(smash("먼데", "a", "b", "c", "d")); } public static String smash(String... words) { String smash = new String(); for (int i = 0; i < words.length; i++){ smash += words[i]; if (i != words.length - 1){ smash += " "; } } return smash; } } ..