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