ALGORITHM ๐Ÿค–

์•Œ๊ณ ๋ฆฌ์ฆ˜ ์—ฐ์Šต / ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ค€๋น„
https://school.programmers.co.kr/learn/courses/30/lessons/120815 class Solution { public int solution(int n) { int max = 0; for(int i=1; i
https://school.programmers.co.kr/learn/courses/30/lessons/120813 class Solution { public int[] solution(int n) { int[] answer = new int[(n / 2) + (n % 2)]; // ๋ฐฐ์—ด์˜ ํฌ๊ธฐ ์ง€์ • int a = 1; for(int i = 0; i < answer.length; i++){ // ๋ฐฐ์—ด ํฌ๊ธฐ๋งŒํผ ๋ฐ˜๋ณต answer[i] = a; // ํ™€์ˆ˜๋งŒ ๋‹ด๊ธฐ a += 2; } return answer; } }
https://school.programmers.co.kr/learn/courses/30/lessons/120811 import java.util.Arrays; // ํด๋ž˜์Šค ์ •์˜ class Solution { public int solution(int[] array) { Arrays.sort(array); // ์ •๋ ฌ ๋ฉ”์†Œ๋“œ ์‚ฌ์šฉํ•˜์—ฌ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌ int answer = array[array.length/2]; // ์ค‘์•™๊ฐ’ ๊ตฌํ•˜๊ธฐ return answer; } }
https://school.programmers.co.kr/learn/courses/30/lessons/120808?language=java class Solution { public int[] solution(int numer1, int denom1, int numer2, int denom2) { int numer = (numer1 * denom2) + (numer2 * denom1); // ํ†ต๋ถ„ํ–ˆ์„ ๋•Œ ๋ถ„์ž int denom = denom1 * denom2; // ํ†ต๋ถ„ํ–ˆ์„ ๋•Œ ๋ถ„๋ชจ for(int i = numer - 1; i > 1; i--){ // ๊ธฐ์•ฝ๋ถ„์ˆ˜ ์ธ์ง€ ์ฒดํฌ if(numer % i == 0 && denom % i == 0){ // ๊ธฐ์•ฝ๋ถ„์ˆ˜๊ฐ€ ์•„๋‹ˆ๋ฉด ์•ฝ๋ถ„ํ•ด์ฃผ๊ธฐ numer /= i; denom..
https://school.programmers.co.kr/learn/courses/30/lessons/120833 class Solution { public int[] solution(int[] numbers, int num1, int num2) { int[] answer = new int [num2 - num1 + 1]; // ๋ฐฐ์—ด์˜ ํฌ๊ธฐ๋ฅผ ์„ค์ • int a = 0; for(int i = num1; i
https://www.acmicpc.net/problem/2475 2475๋ฒˆ: ๊ฒ€์ฆ์ˆ˜ ์ปดํ“จํ„ฐ๋ฅผ ์ œ์กฐํ•˜๋Š” ํšŒ์‚ฌ์ธ KOI ์ „์ž์—์„œ๋Š” ์ œ์กฐํ•˜๋Š” ์ปดํ“จํ„ฐ๋งˆ๋‹ค 6์ž๋ฆฌ์˜ ๊ณ ์œ ๋ฒˆํ˜ธ๋ฅผ ๋งค๊ธด๋‹ค. ๊ณ ์œ ๋ฒˆํ˜ธ์˜ ์ฒ˜์Œ 5์ž๋ฆฌ์—๋Š” 00000๋ถ€ํ„ฐ 99999๊นŒ์ง€์˜ ์ˆ˜ ์ค‘ ํ•˜๋‚˜๊ฐ€ ์ฃผ์–ด์ง€๋ฉฐ 6๋ฒˆ์งธ ์ž๋ฆฌ์—๋Š” ๊ฒ€์ฆ์ˆ˜๊ฐ€ ๋“ค 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(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc..
https://www.acmicpc.net/problem/2438 2438๋ฒˆ: ๋ณ„ ์ฐ๊ธฐ - 1 ์ฒซ์งธ ์ค„์—๋Š” ๋ณ„ 1๊ฐœ, ๋‘˜์งธ ์ค„์—๋Š” ๋ณ„ 2๊ฐœ, 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(); String s = "*"; for(int i = 0; i < n; i++){ for(int j = 0; j < i+1; j++) System.out.print(s); System.out.print("\n"); } } }
daxx0ne
'ALGORITHM ๐Ÿค–' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (14 Page)