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