https://www.acmicpc.net/problem/1026 1026๋ฒ: ๋ณด๋ฌผ ์ฒซ์งธ ์ค์ N์ด ์ฃผ์ด์ง๋ค. ๋์งธ ์ค์๋ A์ ์๋ N๊ฐ์ ์๊ฐ ์์๋๋ก ์ฃผ์ด์ง๊ณ , ์
์งธ ์ค์๋ B์ ์๋ ์๊ฐ ์์๋๋ก ์ฃผ์ด์ง๋ค. N์ 50๋ณด๋ค ์๊ฑฐ๋ ๊ฐ์ ์์ฐ์์ด๊ณ , A์ B์ ๊ฐ ์์๋ 100๋ณด๋ค ์๊ฑฐ www.acmicpc.net import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr1 = new int[n]; int[] arr2 = new int[n]..
ALGORITHM ๐ค
์๊ณ ๋ฆฌ์ฆ ์ฐ์ต / ์ฝ๋ฉํ ์คํธ ์ค๋นhttps://www.acmicpc.net/problem/10872 10872๋ฒ: ํฉํ ๋ฆฌ์ผ 0๋ณด๋ค ํฌ๊ฑฐ๋ ๊ฐ์ ์ ์ N์ด ์ฃผ์ด์ง๋ค. ์ด๋, N!์ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int answer = 1; for (int i = 1; i
https://www.acmicpc.net/problem/2558 2558๋ฒ: A+B - 2 ์ฒซ์งธ ์ค์ A, ๋์งธ ์ค์ B๊ฐ ์ฃผ์ด์ง๋ค. (0 < A, B < 10) www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a+b); } }
https://www.acmicpc.net/problem/10718 10718๋ฒ: We love kriii ACM-ICPC ์ธํฐ๋ท ์์ , Regional, ๊ทธ๋ฆฌ๊ณ World Finals๊น์ง ์ด๋ฏธ 2ํ์ฉ ์ง์ถํด๋ฒ๋ฆฐ kriii๋ ๋ฏธ๋ จ์ ๋ฒ๋ฆฌ์ง ๋ชปํ๊ณ ์ ์ง ๋ชจ๋ฅด๊ฒ ์ฌํด์๋ ํ์ฃผ World Finals ์ค๋น ์บ ํ์ ์ฐธ์ฌํ๋ค. ๋ํ๋ฅผ ๋ฐ ์ค ๋ชจ๋ฅด๋ ์ง๋ฐ www.acmicpc.net public class Main { public static void main(String[] args) { System.out.println("๊ฐํ์น๊ตฌ ๋ํ์ก๊ตฐ"); System.out.println("๊ฐํ์น๊ตฌ ๋ํ์ก๊ตฐ"); } }
https://www.acmicpc.net/problem/2748 2748๋ฒ: ํผ๋ณด๋์น ์ 2 ํผ๋ณด๋์น ์๋ 0๊ณผ 1๋ก ์์ํ๋ค. 0๋ฒ์งธ ํผ๋ณด๋์น ์๋ 0์ด๊ณ , 1๋ฒ์งธ ํผ๋ณด๋์น ์๋ 1์ด๋ค. ๊ทธ ๋ค์ 2๋ฒ์งธ ๋ถํฐ๋ ๋ฐ๋ก ์ ๋ ํผ๋ณด๋์น ์์ ํฉ์ด ๋๋ค. ์ด๋ฅผ ์์ผ๋ก ์จ๋ณด๋ฉด Fn = Fn-1 + Fn-2 (n ≥ 2)๊ฐ www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long num1 = 0; long num2 = 1; for (int i = 0; i < n; i++)..
https://www.acmicpc.net/problem/2747 2747๋ฒ: ํผ๋ณด๋์น ์ ํผ๋ณด๋์น ์๋ 0๊ณผ 1๋ก ์์ํ๋ค. 0๋ฒ์งธ ํผ๋ณด๋์น ์๋ 0์ด๊ณ , 1๋ฒ์งธ ํผ๋ณด๋์น ์๋ 1์ด๋ค. ๊ทธ ๋ค์ 2๋ฒ์งธ ๋ถํฐ๋ ๋ฐ๋ก ์ ๋ ํผ๋ณด๋์น ์์ ํฉ์ด ๋๋ค. ์ด๋ฅผ ์์ผ๋ก ์จ๋ณด๋ฉด Fn = Fn-1 + Fn-2 (n ≥ 2)๊ฐ www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int num1 = 0; int num2 = 1; for (int i = 0; i < n; i++) { i..
https://school.programmers.co.kr/learn/courses/30/lessons/12917 class Solution { public String solution(String s) { String answer = ""; char [] arr = s.toCharArray(); char temp; for (int i = 0; i < arr.length - 1; i++){ for(int j = i + 1; j < arr.length; j++){ if(arr[i] < arr[j]){ temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } } for(int i = 0; i < arr.length; i++){ answer += arr[i]; } return..