package test; import java.util.Scanner; public class Test2 { public static void main(String[] args) { Test2 test = new Test2(); Scanner in = new Scanner(System.in); int n = in.nextInt(); System.out.println(test.d(n));; } public int d(int n){ int count = 0; for(int i = 1 ; i
์ ๊ทผ๋ฐฉ๋ฒ 1. ์ ๋ ฅํ ์๊น์ง์ ๋ชจ๋ ์ผ์๋ฅผ ๋ํ๋ค. (ex 3์ => 31+28+31) 2. ํด๋น ์์ ๋ง์ง๋ง ์ผ์ - ์ ๋ ฅํ ์ผ์ (ex 3์ 10์ผ => 31 - 10 ) 3. ๋ชจ๋ ์ผ์ - (์ ๋ ฅ ์์ ๋ง์ง๋ง์ผ์ - ์ ๋ ฅ ์ผ์ ) = >totalDate 4. totalDate๋ฅผ 7๋ก ๋๋ ๋๋จธ์ง์ ๊ฐ์ ์์ผ๋ก ์ ์ (1=์, 2= ํ .... ) public static void main(String[] args) { int[] months = {31,28,31,30,31,30,31,31,30,31,30,31}; char[] days = {'์','ํ','์','๋ชฉ','๊ธ','ํ ','์ผ'}; int totalDate = 0; Scanner scanner = new Scanner(System.in); ..
์ ๊ทผ๋ฐฉ๋ฒ 1. ๋จ์ด์ ๋จ์ด์ฌ์ด์๋ ๊ณต๋ฐฑ์ด ์กด์ฌํจ์ผ๋ก, ๋์์ฐ๊ธฐ(๊ณต๋ฐฑ)์ ๊ฐฏ์๋ก ๋จ์ด์๋ฅผ ํ๋จ. 2. ๋ฌธ์ฅ ๋์ ๋์์ฐ๊ธฐ๊ฐ ์กด์ฌํ๋ ๊ฒฝ์ฐ๋ฅผ ํ๋จํ์ฌ ๊ฒฐ๊ณผ๋ณ์์ ์ด๊ธฐ๊ฐ์ด ๋ฌ๋ผ์ง๋ค. 3. ๋ฌธ์ฅ์ ํ๊ธ์์ฉ ๋น๊ตํ๋ฉด์ ๋์์ฐ๊ธฐ๊ฐ ๋ํ๋๋ฉด ๋จ์ด์ ๊ฐฏ์๋ฅผ ์ฆ๊ฐ์ํจ๋ค. ์ฆ, A_B_C = ๋์์ฐ๊ธฐ๊ฐ 2๊ฐ์ด๋ฏ๋ก ์ด๊ธฐ๊ฐ wordCnt = 1; A_B_C_ = ๋์์ฐ๊ธฐ๊ฐ 3๊ฐ์ด๋ฏ๋ก ์ด๊ธฐ๊ฐ wordCnt = 0; public class Main { public static void main(String[] args) { String content = "Teullinika Teullyeotzi"; char[] list = content.toCharArray(); int wordCnt = list[content.length()-..
์ ๊ทผ๋ฐฉ๋ฒ 1. ํฌ๋ก์ํฐ์ ์ํ๋ฒณ ๋ฆฌ์คํธ๋ฅผ ๋ง๋ ๋ค. 2. ์ ๋ ฅ๋ ๋ฌธ์์ด๊ณผ ํฌ๋ก์ํฐ์ ์ํ๋ฒณ ๋ฆฌ์คํธ๋ฅผ ๋น๊ตํ๋ค. 3. ํฌ๋ก์ํฐ์ ์ํ๋ฒณ์ ๋ชจ๋ # ์ผ๋ก ๋ณ๊ฒฝ ํด์ค๋ค. 4. ์ํ๋ฒณ ํฌ๊ธฐ๋ฅผ ์ถ๋ ฅํ๋ค. public class Main { public static void main(String[] args) { // ๋น๊ต ๋ฌธ์์ด String[] alphabetList = {"c=","c-","dz=","d-","lj","nj","s=","z="}; String work = "ljes=njaknjnj"; for(int i = 0 ; i < alphabetList.length ;i++) { if(work.contains(alphabetList[i])) { work = work.replace(alphabetList[i]..