백준 40

백준[JAVA] 2750.수 정렬하기 - 자바

📖 문제 📃 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int array[]; int size = Integer.parseInt(br.readLine()); array = new int[size]; for(int i=0; i< size; i++){ array[i]..

백준[JAVA] 2355.시그마 - 자바

📖 문제 📃 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static long sum(long A, long B) { long result = (A + B) * ((B - A + 1) / 2); System.out.println((B - A + 1) / 2); // if numbers are odd if ((B - A + 1) % 2 != 0) { result += (A + B) / 2; } return result; } public static void main(String[] ar..

백준[JAVA] 1964.오각형, 오각형, 오각형... - 자바

📖 문제 📃 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { // Arithmetic Sequence static long AS(int N) { long a = 5; long d = 7; // logic for (int i = 0; i < N - 1; i++) { a += d; d += 3; } return a % 45678; } public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Sy..

백준[JAVA] 1712.손익분기점 - 자바

📖 문제 📃 코드 1. for문 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int BEP(int stabelPrice, int variablePrice, int productPrice) { for (int i = 1;; i++) { // BEP Achievement if (stabelPrice / (productPrice - variablePrice) < i) return i; } } public static void main(String[] args) throws IOException { BufferedReader br = new B..