ALGORITHM ๐Ÿค–

์•Œ๊ณ ๋ฆฌ์ฆ˜ ์—ฐ์Šต / ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ค€๋น„
https://www.acmicpc.net/problem/1459 1459๋ฒˆ: ๊ฑท๊ธฐ ์„ธ์ค€์ด๋Š” ํ•™๊ต์—์„œ ์ง‘์œผ๋กœ ๊ฐ€๋ ค๊ณ  ํ•œ๋‹ค. ๋„์‹œ์˜ ํฌ๊ธฐ๋Š” ๋ฌดํ•œ๋Œ€์ด๊ณ , ๋„์‹œ์˜ ์„ธ๋กœ ๋„๋กœ๋Š” ๋ชจ๋“  ์ •์ˆ˜ x์ขŒํ‘œ๋งˆ๋‹ค ์žˆ๊ณ , ๊ฐ€๋กœ ๋„๋กœ๋Š” ๋ชจ๋“  ์ •์ˆ˜ y์ขŒํ‘œ๋งˆ๋‹ค ์žˆ๋‹ค. ์„ธ์ค€์ด๋Š” ํ˜„์žฌ (0, 0)์— ์žˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ( www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long x = sc.nextLong(); // ์ง‘์˜ ์œ„์น˜ x์ขŒํ‘œ long y = sc.nextLong(); // ์ง‘์˜ ์œ„์น˜ y์ขŒํ‘œ long w = sc.nextLong(); // ๊ฑธ์–ด์„œ..
https://school.programmers.co.kr/learn/courses/30/lessons/42889 import java.util.*; class Solution { public int[] solution(int N, int[] stages) { Map map = new HashMap(); for (int i = 1; i = i) { all++; if (j == i) { fail++; } } } double per = (double) fail / all; // ์‹คํŒจ์œจ if(fail == 0 && all == 0) { // ๋ชจ๋“  ์‚ฌ๋žŒ๋“ค์ด ์‹œ๋„์กฐ์ฐจ ๋ชปํ•œ ์Šคํ…Œ์ด์ง€๊ฐ€ ์žˆ์„ ๋•Œ๋Š” 0์œผ๋กœ ์ฒ˜๋ฆฌ (0 / 0 = NaN ๋ฐฉ์ง€) per = 0; } map.put(i, per); // key: ์Šคํ…Œ์ด์ง€, v..
https://school.programmers.co.kr/learn/courses/30/lessons/42840 import java.util.*; class Solution { public int[] solution(int[] answers) { int[] supoza1 = {1, 2, 3, 4, 5}; int[] supoza2 = {2, 1, 2, 3, 2, 4, 2, 5}; int[] supoza3 = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5}; int[] score = new int[3]; int a = 1; int temp = 0; for (int k : answers) { // ์ˆ˜ํฌ์ž1 ์ ์ˆ˜ ๊ตฌํ•˜๊ธฐ if (supoza1[temp] == k) { score[0] += a; } te..
https://www.acmicpc.net/problem/25206 25206๋ฒˆ: ๋„ˆ์˜ ํ‰์ ์€ ์ธํ•˜๋Œ€ํ•™๊ต ์ปดํ“จํ„ฐ๊ณตํ•™๊ณผ๋ฅผ ์กธ์—…ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š”, ์ „๊ณตํ‰์ ์ด 3.3 ์ด์ƒ์ด๊ฑฐ๋‚˜ ์กธ์—…๊ณ ์‚ฌ๋ฅผ ํ†ต๊ณผํ•ด์•ผ ํ•œ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์•„๋ฟ”์‹ธ, ์น˜ํ›ˆ์ด๋Š” ๊นœ๋นกํ•˜๊ณ  ์กธ์—…๊ณ ์‚ฌ๋ฅผ ์‘์‹œํ•˜์ง€ ์•Š์•˜๋‹ค๋Š” ์‚ฌ์‹ค์„ ๊นจ๋‹ฌ์•˜๋‹ค! ์น˜ www.acmicpc.net import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double score = 0; // ๊ณผ๋ชฉํ‰์  double credit = 0; // ํ•™์  double sum = 0; // ํ•™์ ์˜ ์ดํ•ฉ double all = 0; // (ํ•™์  × ๊ณผ๋ชฉํ‰์ )์˜..
https://school.programmers.co.kr/learn/courses/30/lessons/176963 class Solution { public int[] solution(String[] name, int[] yearning, String[][] photo) { int[] answer = new int[photo.length]; for (int i = 0; i < photo.length; i++) { for (int j = 0; j < photo[i].length; j++) { for (int k = 0; k < name.length; k++) { if (name[k].equals(photo[i][j])) { answer[i] += yearning[k]; } } } } return answ..
https://www.acmicpc.net/problem/2675 2675๋ฒˆ: ๋ฌธ์ž์—ด ๋ฐ˜๋ณต ๋ฌธ์ž์—ด S๋ฅผ ์ž…๋ ฅ๋ฐ›์€ ํ›„์—, ๊ฐ ๋ฌธ์ž๋ฅผ R๋ฒˆ ๋ฐ˜๋ณตํ•ด ์ƒˆ ๋ฌธ์ž์—ด P๋ฅผ ๋งŒ๋“  ํ›„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ฆ‰, ์ฒซ ๋ฒˆ์งธ ๋ฌธ์ž๋ฅผ R๋ฒˆ ๋ฐ˜๋ณตํ•˜๊ณ , ๋‘ ๋ฒˆ์งธ ๋ฌธ์ž๋ฅผ R๋ฒˆ ๋ฐ˜๋ณตํ•˜๋Š” ์‹์œผ๋กœ P๋ฅผ ๋งŒ๋“ค๋ฉด ๋œ๋‹ค 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 r = sc.nextInt(); String s = sc.next(); Stri..
https://www.acmicpc.net/problem/1037 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++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); int answer = arr[0] * arr[arr.length - 1]; System.out.println(answer); } }
daxx0ne
'ALGORITHM ๐Ÿค–' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (4 Page)