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
ALGORITHM ๐ค
์๊ณ ๋ฆฌ์ฆ ์ฐ์ต / ์ฝ๋ฉํ ์คํธ ์ค๋น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"); } } }