https://www.acmicpc.net/problem/1009 1009๋ฒ: ๋ถ์ฐ์ฒ๋ฆฌ ์
๋ ฅ์ ์ฒซ ์ค์๋ ํ
์คํธ ์ผ์ด์ค์ ๊ฐ์ T๊ฐ ์ฃผ์ด์ง๋ค. ๊ทธ ๋ค์ ์ค๋ถํฐ ๊ฐ๊ฐ์ ํ
์คํธ ์ผ์ด์ค์ ๋ํด ์ ์ a์ b๊ฐ ์ฃผ์ด์ง๋ค. (1 ≤ a < 100, 1 ≤ b < 1,000,000) www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int num = 1; fo..
ALGORITHM ๐ค
์๊ณ ๋ฆฌ์ฆ ์ฐ์ต / ์ฝ๋ฉํ ์คํธ ์ค๋นhttps://www.acmicpc.net/problem/11501 11501๋ฒ: ์ฃผ์ ์
๋ ฅ์ ์ฒซ ์ค์๋ ํ
์คํธ์ผ์ด์ค ์๋ฅผ ๋ํ๋ด๋ ์์ฐ์ T๊ฐ ์ฃผ์ด์ง๋ค. ๊ฐ ํ
์คํธ์ผ์ด์ค ๋ณ๋ก ์ฒซ ์ค์๋ ๋ ์ ์๋ฅผ ๋ํ๋ด๋ ์์ฐ์ N(2 ≤ N ≤ 1,000,000)์ด ์ฃผ์ด์ง๊ณ , ๋์งธ ์ค์๋ ๋ ๋ณ ์ฃผ๊ฐ๋ฅผ ๋ํ www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); long[] arr = new long[n]..
https://school.programmers.co.kr/learn/courses/30/lessons/17681 class Solution { public String[] solution(int n, int[] arr1, int[] arr2) { String[] answer = new String[n]; for(int i = 0; i ๊ณต๋ฐฑ' ๋ณํ answer[i] = answer[i].replace("1", "#"); // '1 -> #'' ๋ณํ while (answer[i]...
https://www.acmicpc.net/problem/2750 2750๋ฒ: ์ ์ ๋ ฌํ๊ธฐ ์ฒซ์งธ ์ค์ ์์ ๊ฐ์ N(1 ≤ N ≤ 1,000)์ด ์ฃผ์ด์ง๋ค. ๋์งธ ์ค๋ถํฐ N๊ฐ์ ์ค์๋ ์๊ฐ ์ฃผ์ด์ง๋ค. ์ด ์๋ ์ ๋๊ฐ์ด 1,000๋ณด๋ค ์๊ฑฐ๋ ๊ฐ์ ์ ์์ด๋ค. ์๋ ์ค๋ณต๋์ง ์๋๋ค. www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++){ int num = sc.nextInt(); arr[i] = nu..
https://www.acmicpc.net/problem/11727 11727๋ฒ: 2×n ํ์ผ๋ง 2 2×n ์ง์ฌ๊ฐํ์ 1×2, 2×1๊ณผ 2×2 ํ์ผ๋ก ์ฑ์ฐ๋ ๋ฐฉ๋ฒ์ ์๋ฅผ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค. ์๋ ๊ทธ๋ฆผ์ 2×17 ์ง์ฌ๊ฐํ์ ์ฑ์ด ํ๊ฐ์ง ์์ด๋ค. www.acmicpc.net import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] dp = new int[n + 1]; ..
https://school.programmers.co.kr/learn/courses/30/lessons/68935 class Solution { public int solution(int n) { int answer = 0; String temp = Integer.toString(n, 3); // 10์ง๋ฒ -> 3์ง๋ฒ String reverse = ""; for (int i = temp.length() - 1; i >= 0; i--) { // 3์ง๋ฒ ์์์ ์๋ค ๋ฐ์ reverse = reverse + temp.charAt(i); } answer = Integer.parseInt(reverse, 3); // ๋ฐ์ ํ 3์ง๋ฒ -> 10์ง๋ฒ return answer; } }