'c' 태그의 글 목록
본문 바로가기
728x90
반응형

c6

2021.12.11_데코레이터패턴02.패턴적용하기 CommentService public interface CommentService { void addComment(String comment); } 코멘트를 추가한 인터페이스 하나 추가 DefaultCommentService public class DefaultCommentService implement CommentService{ @Override public void addComment(String comment){ System.out.println(comment); } } CommentDecorator public class CommentDecorator implements CommentService{ private CommentService commentService; public Comment.. 2021. 12. 11.
2021.10.22_3431-준환이의운동관리 소스코드 #include #include using namespace std; int L, U, X;//운동 기록 int answer; void init();//초기화 및 초기입력 void checkHealth();//운동 체크 int main(int argc, char** argv) { int test_case; int T; scanf("%d", &T); for (test_case = 1; test_case 2021. 10. 22.
2021.10.22_11736-평범한숫자 소스코드 #include using namespace std; int N; int answer; int arr[21];//숫자 저장 void init();//초기화 및 초기 입력 void normalNumber();//평범한 숫자 확인 int main(int argc, char** argv) { int test_case; int T; scanf("%d", &T); for (test_case = 1; test_case arr[i])big++; if (arr[i + 1] > arr[i]) big++; if (small == 1 && big == 1)answer++; } } 설계 사실 문제가 너무 쉽긴한데 위의 방식처럼 사이값이 숫자인가 판별만 하면되는듯 그래서 중간 수라면 조건이 한개보다는 작아야하고 한개보.. 2021. 10. 22.
2021년08월04일_16953-A->B #include #include #include #include #include #include using namespace std; struct Data { long long int number; int cnt; }; int A, B, ret;//A: 시작, B: 만들어야하는 숫자, ret: 결과값 void init() { A = B = 0; ret = 0x7fffffff; scanf("%d %d", &A, &B); } void AtoB() { mapvisit;// 방문 체크 맵 queueq; q.push({ A,1 }); visit[A] = 1; while (!q.empty()) { Data current = q.front(); q.pop(); if (current.number > B || curre.. 2021. 8. 7.
728x90
반응형