728x90 programming60 백준(Baekjoon)_9095번 문제풀이 다이나믹 프로그래밍에서 정답비율 좀 높길래 도전. 근데 어려운편. 첨에 재귀느낌이 왔지만 방학동안 머리를 안쓰니 '재귀 사용해야할 것 같은데 이제부터 어떻게 해야되는거지.' 이러다 결국 몇몇 블로그를 참고하고 난 후 '아 이게 재귀였지.' 하고 풀었다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include int f(int n)//순서 상관있는 것에 유의하며 세기 { int count = 0; if(n == 1) return count += 1;//1이되는 경우의수 : 1 else if(n == 2) return count += 2;//2가되는 경우의수 : 1+1,2 else if(n == 3) return cou.. 2020. 1. 14. [java] charAt(), indexOf()메소드 이용하는 프로그램 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import java.util.Scanner; public class IndexOfTest { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String s; System.out.println("문장입력 : "); s = sc.next(); int index = s.indexOf("A"); //A가 몇번째에 있는지 반환(정수형) char c = s.charAt(0); //0번째 문자를 반환(캐릭터형) if (index == -1) Syste.. 2019. 10. 25. [C언어] 두 배열의 합집합, 교집합, 차집합 구하는 함수 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 12.. 2019. 10. 18. [C언어] 포인터 사용하여 배열 이어붙이기,정렬확인,비교 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 #include int stringCompare(const char *s1, const char *s2) { while (*s1 || *s2) { if(*s1 != *s2) { if(*s1 > *s2) return -1; else return 1; } s1++; s2++; } return 0; } void stringCat(char *s1, const char *s2) { while (*s1) s1.. 2019. 10. 15. java - Double형 배열과 출력(toString(),for-each) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import java.util.*; public class Assignment4_1 { public static void main(String[] args) { // TODO Auto-generated method stub double[] arr = {1.0, 2.0, 3.0, 4.0}; double total = 0.0; double max = 0.0; System.out.print("toString()으로 출력 : "); System.out.println(Arrays.toString(arr)); for (double value : arr) { System.out.print(value+" "); .. 2019. 10. 9. java ArrayList - add(), get(), remove()정리 ArrayList를 알아보자. 1 2 3 4 5 6 7 8 9 10 import java.util.*; public class ArrayPractice { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList list= new ArrayList(); list.add("오렌지"); list.add("사과"); list.add("포도"); http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs 이런식으로 ArrayList(리스트의 이름)이 들어간다. list.add()를 이용해 리스트를 채워준다. 그.. 2019. 10. 8. 이전 1 ··· 4 5 6 7 다음 728x90