ALGORITHM ๐Ÿค–

์•Œ๊ณ ๋ฆฌ์ฆ˜ ์—ฐ์Šต / ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ค€๋น„
https://www.acmicpc.net/problem/9498 9498๋ฒˆ: ์‹œํ—˜ ์„ฑ์  ์‹œํ—˜ ์ ์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 90 ~ 100์ ์€ A, 80 ~ 89์ ์€ B, 70 ~ 79์ ์€ C, 60 ~ 69์ ์€ D, ๋‚˜๋จธ์ง€ ์ ์ˆ˜๋Š” F๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); if(A >= 90){ System.out.println("A"); } else if(A >= 80){ System.out.println("B"); } else if..
https://www.acmicpc.net/problem/1330 1330๋ฒˆ: ๋‘ ์ˆ˜ ๋น„๊ตํ•˜๊ธฐ ๋‘ ์ •์ˆ˜ A์™€ B๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, A์™€ B๋ฅผ ๋น„๊ตํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int A = in.nextInt(); int B = in.nextInt(); if(A>B){ System.out.println(">"); // A๊ฐ€ B๋ณด๋‹ค ํฐ ๊ฒฝ์šฐ } else if(A
https://www.acmicpc.net/problem/2753 2753๋ฒˆ: ์œค๋…„ ์—ฐ๋„๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ์œค๋…„์ด๋ฉด 1, ์•„๋‹ˆ๋ฉด 0์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์œค๋…„์€ ์—ฐ๋„๊ฐ€ 4์˜ ๋ฐฐ์ˆ˜์ด๋ฉด์„œ, 100์˜ ๋ฐฐ์ˆ˜๊ฐ€ ์•„๋‹ ๋•Œ ๋˜๋Š” 400์˜ ๋ฐฐ์ˆ˜์ผ ๋•Œ์ด๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, 2012๋…„์€ 4์˜ ๋ฐฐ์ˆ˜์ด๋ฉด์„œ www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int year = sc.nextInt(); // ์—ฐ๋„๋ฅผ ์ž…๋ ฅ๋ฐ›์Œ if(year % 4 == 0 && year % 100 != 0){ // 4์˜ ๋ฐฐ์ˆ˜์ด๊ณ  100์˜ ๋ฐฐ์ˆ˜๊ฐ€..
https://school.programmers.co.kr/learn/courses/30/lessons/120825 class Solution { public String solution(String my_string, int n) { String answer = ""; for(int i=0; i < my_string.length(); i++){ // ๋ฌธ์ž์—ด์˜ ๊ธธ์ด๋งŒํผ ์•„๋ž˜ for ๋ฌธ์„ ๋ฐ˜๋ณต for(int j=0; j
https://school.programmers.co.kr/learn/courses/30/lessons/120585 class Solution { public int solution(int[] array, int height) { int answer = 0; for(int i=0; i height){ //๋ฐฐ์—ด์˜ i๋ฒˆ์งธ ์š”์†Œ๊ฐ€ height(๋จธ์“ฑ์ด ํ‚ค)๋ณด๋‹ค ํฌ๋ฉด answer++; //answer์˜ ๊ฐ’์„ 1์”ฉ ์ฆ๊ฐ€ } } return answer; } }
https://school.programmers.co.kr/learn/courses/30/lessons/120826 class Solution { public String solution(String my_string, String letter) { String answer = ""; answer = my_string.replace(letter, ""); //letter์— ๋“ค์–ด์žˆ๋Š” ๋ฌธ์ž๋ฅผ ""๋กœ ์น˜ํ™˜ํ•˜์—ฌ ์ œ๊ฑฐ return answer; } } ๋ฌธ์ž์—ด์—์„œ ํŠน์ • ๋ฌธ์ž๋ฅผ ์ œ๊ฑฐํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” .replace(์ง€์šฐ๊ณ ์‹ถ์€ ๋ฌธ์ž, "") ๋ฅผ ํ•ด์ฃผ๋ฉด ๋œ๋‹ค!
https://school.programmers.co.kr/learn/courses/30/lessons/120583 class Solution { public int solution(int[] array, int n) { int answer = 0; for(int i=0; i < array.length; i++){ if(array[i] == n){ //array ๋ฐฐ์—ด์˜ i๋ฒˆ์งธ ์š”์†Œ๊ฐ€ n๊ณผ ๊ฐ™๋‹ค๋ฉด answer = answer + 1; // answer ๊ฐ’ 1์”ฉ ์ฆ๊ฐ€ (n์ด ๋ช‡ ๊ฐœ ์ธ์ง€ ์„ธ๊ธฐ) } } return answer; } }
daxx0ne
'ALGORITHM ๐Ÿค–' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (16 Page)