https://school.programmers.co.kr/learn/courses/30/lessons/12928 class Solution { public int solution(int n) { int answer = 0; for(int i = 1; i
ALGORITHM ๐ค
์๊ณ ๋ฆฌ์ฆ ์ฐ์ต / ์ฝ๋ฉํ ์คํธ ์ค๋นhttps://school.programmers.co.kr/learn/courses/30/lessons/120910 class Solution { public int solution(int n, int t) { int answer = n; for (int i = 1; i
https://school.programmers.co.kr/learn/courses/30/lessons/120903 class Solution { public int solution(String[] s1, String[] s2) { int answer = 0; for(int i = 0; i < s2.length; i++){ for(int j = 0; j < s1.length; j++){ if(s2[i].equals(s1[j])){ // ๋ฌธ์์ด์ด ๊ฐ์์ง ๋น๊ตํ ๋๋ .equals() ๋ฅผ ์ฌ์ฉ answer++; } } } return answer; } }
https://school.programmers.co.kr/learn/courses/30/lessons/120909 class Solution { public int solution(int n) { int answer = 0; for(int i = 1; i
https://school.programmers.co.kr/learn/courses/30/lessons/120836 class Solution { public int solution(int n) { int answer = 0; for(int i = 1; i
https://www.acmicpc.net/problem/11021 11021๋ฒ: A+B - 7 ๊ฐ ํ
์คํธ ์ผ์ด์ค๋ง๋ค "Case #x: "๋ฅผ ์ถ๋ ฅํ ๋ค์, A+B๋ฅผ ์ถ๋ ฅํ๋ค. ํ
์คํธ ์ผ์ด์ค ๋ฒํธ๋ 1๋ถํฐ ์์ํ๋ค. www.acmicpc.net import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int[] arr = new int[t]; // t๋งํผ ๋ฐฐ์ด์ ํฌ๊ธฐ๋ฅผ ์ง์ int i = 0; while (i < t) { // t๋งํผ ๋ฐ๋ณต int a = sc.nextInt(); int b = sc.next..
https://school.programmers.co.kr/learn/courses/30/lessons/120837 class Solution { public int solution(int hp) { int general = 0; int soldier = 0; int worker = 0; general = hp / 5; // ์ฅ๊ตฐ๊ฐ๋ฏธ hp %= 5; soldier = hp / 3; // ๋ณ์ ๊ฐ๋ฏธ hp %= 3; worker = hp; // ์ผ๊ฐ๋ฏธ int answer = general + soldier + worker; // ์ต์ ๋ณ๋ ฅ return answer; } }