ALGORITHM ๐Ÿค–

์•Œ๊ณ ๋ฆฌ์ฆ˜ ์—ฐ์Šต / ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์ค€๋น„
https://www.acmicpc.net/step/1 ์ž…์ถœ๋ ฅ๊ณผ ์‚ฌ์น™์—ฐ์‚ฐ ๋‹จ๊ณ„ ์ž…์ถœ๋ ฅ๊ณผ ์‚ฌ์น™์—ฐ์‚ฐ www.acmicpc.net 10926 ??! import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String A = in.next(); System.out.println(A + "??!"); in.close(); } } 18108 1988๋…„์ƒ์ธ ๋‚ด๊ฐ€ ํƒœ๊ตญ์—์„œ๋Š” 2541๋…„์ƒ?! import java.util.Scanner; public class Main { public static void main(String[] args) { Scanne..
https://www.acmicpc.net/step/1 ์ž…์ถœ๋ ฅ๊ณผ ์‚ฌ์น™์—ฐ์‚ฐ ๋‹จ๊ณ„ ์ž…์ถœ๋ ฅ๊ณผ ์‚ฌ์น™์—ฐ์‚ฐ www.acmicpc.net 1000 A+B 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(); System.out.println(A+B); in.close(); } } 1001 A-B import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = n..
https://www.acmicpc.net/problem/2557 2557๋ฒˆ: Hello World Hello World!๋ฅผ ์ถœ๋ ฅํ•˜์‹œ์˜ค. www.acmicpc.net public class Main { public static void main(String[] args) { System.out.println("Hello World!"); } }
https://school.programmers.co.kr/learn/courses/30/lessons/120821 class Solution { public int[] solution(int[] num_list) { //num_list์˜ ๊ธธ์ด๋งŒํผ answer ๋ฐฐ์—ด์˜ ํฌ๊ธฐ๋ฅผ ์ง€์ • int[] answer = new int[num_list.length]; for(int i = 0; i < num_list.length; i++){ //0๋ถ€ํ„ฐ num_list์˜ ๊ธธ์ด๋งŒํผ ๋ฐ˜๋ณต answer[i] = num_list[num_list.length - i -1]; return answer; //answer์„ ๋ฆฌํ„ดํ•˜๋ฉด num_list ๋ฐฐ์—ด์ด ๋’ค์ง‘์–ด์ ธ์„œ ๋‚˜์˜ด! } }
https://school.programmers.co.kr/learn/courses/30/lessons/120814 class Solution { public int solution(int n) { int answer = 0; if(n % 7 != 0){ //n์„ 7๋กœ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€๊ฐ€ 0์ด ์•„๋‹ˆ๋ผ๋ฉด answer += n / 7 + 1; //n์„ 7๋กœ ๋‚˜๋ˆˆ ๋ชซ์— 1์„ ๋”ํ•ด์„œ return } else{ answer = n / 7; //n์ด 7๋กœ ๋‚˜๋ˆ„์–ด ๋–จ์–ด์ง€๋ฉด ๊ทธ ๋ชซ์„ return } return answer; } } → ๋งŒ์•ฝ 8๋ช…์ด๋ฉด ์ตœ์†Œ 2ํŒ์ด ํ•„์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ์— 7๋กœ ๋‚˜๋ˆˆ ํ›„ ๋‚˜๋จธ์ง€๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ +1์„ ํ•ด์ค˜์•ผ ํ•˜๊ณ , 7๋กœ ๋‚˜๋ˆ„์–ด ๋–จ์–ด์ง€๋Š” ๊ฒฝ์šฐ 7๋ช… ๋‹น 1ํŒ์”ฉ ๋จน์œผ๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ชซ๋งŒ ๋ฆฌํ„ดํ•ด์ฃผ๋ฉด ๋œ๋‹ค!
https://school.programmers.co.kr/learn/courses/30/lessons/120841 class Solution { public int solution(int[] dot) { int answer = 0; if (dot[0] > 0 && dot[1] > 0){ //1์‚ฌ๋ถ„๋ฉด answer = 1; } else if (dot[0] 0){ //2์‚ฌ๋ถ„๋ฉด answer = 2; } else if (dot[0] 0 && dot[1] < 0){ //4์‚ฌ๋ถ„๋ฉด answer = 4; } return answer; } } → ์—ฌ๊ธฐ์„œ dot[0]์€ x์ขŒํ‘œ, dot[1]..
https://school.programmers.co.kr/learn/courses/30/lessons/120824 class Solution { public int[] solution(int[] num_list) { int[] answer = new int [2]; int evv=0; //์ง์ˆ˜ int odd=0; //ํ™€์ˆ˜ for(int i = 0; i < num_list.length; i++){ if(num_list[i] % 2 == 0){ evv++; } else{ odd++; } } answer[0] = evv; answer[1] = odd; return answer; } }
daxx0ne
'ALGORITHM ๐Ÿค–' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (18 Page)