'c++' 태그의 글 목록 (2 Page)
본문 바로가기
728x90
반응형

c++10

프로그래머스 타겟넘버 https://programmers.co.kr/learn/courses/30/lessons/43165 코딩테스트 연습 - 타겟 넘버 n개의 음이 아닌 정수가 있습니다. 이 수를 적절히 더하거나 빼서 타겟 넘버를 만들려고 합니다. 예를 들어 [1, 1, 1, 1, 1]로 숫자 3을 만들려면 다음 다섯 방법을 쓸 수 있습니다. -1+1+1+1+1 = 3 +1-1+1+1+ programmers.co.kr #include #include #include #include #include #include using namespace std; int ret = 0;//최종값 int d[21] = { 0 }; void dfs(int idx,int target,vectornumbers) { if (idx == numbe.. 2020. 7. 16.
JAVA - C++에서의 상속 #include #include using namespace std; class Parent { public: int age; char name[11]; Parent() {} Parent(int age, const char name[11]) { printf("나이 : %d, 이름 : %s\n", age, name); } }; class Child : public Parent { public : int weight; int height; Child(){} Child(int age, const char name[11], int weight, int height) { this->age = age; strcpy(this->name, name); this->weight = weight; this->height =.. 2019. 12. 21.
[모의 SW 역량테스트] 원자 소멸 시뮬레이션 #include #include #include #include using namespace std; int ret; int dy[] = { 1,-1,0,0 }; int dx[] = { 0,0,-1,1 }; struct Data { int y, x, dir, k; }; bool cmp(Data a, Data b) { if (a.y == b.y)return a.x 2000 || v[idx].x 2000)return true; else return false; } void move() { for (int .. 2019. 12. 20.
백준 1107 리모컨 https://www.acmicpc.net/problem/1107 1107번: 리모컨 첫째 줄에 수빈이가 이동하려고 하는 채널 N (0 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 고장난 버튼의 개수 M (0 ≤ M ≤ 10)이 주어진다. 고장난 버튼이 있는 경우에는 셋째 줄에는 고장난 버튼이 주어지며, 같은 버튼이 여러 번 주어지는 경우는 없다. www.acmicpc.net 두가지 방법으로 풀이를 했는데 하나는 재귀를 이용한방법 하나는 0부터 1000000까지 확인하는 방법을 사용했습니다. 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.. 2019. 10. 4.
728x90
반응형