From 877103d09a05edfe62828fbf65de7e42e3a9954e Mon Sep 17 00:00:00 2001 From: lumiere-on Date: Tue, 16 Apr 2024 18:23:27 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[=EB=B0=B1=ED=8A=B8=EB=9E=99=ED=82=B9]=204?= =?UTF-8?q?=EC=9B=94=2016=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 +- .../\355\225\204\354\210\230/14888.cpp" | 65 +++++++++++++++++++ .../\355\225\204\354\210\230/15665.cpp" | 44 +++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 "09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/14888.cpp" create mode 100644 "09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/15665.cpp" diff --git a/.vscode/settings.json b/.vscode/settings.json index efdf324..407746c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,8 @@ "files.associations": { "stack": "cpp", "xiosbase": "cpp", - "map": "cpp" + "map": "cpp", + "vector": "cpp" }, "C_Cpp.errorSquiggles": "disabled" } \ No newline at end of file diff --git "a/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/14888.cpp" "b/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/14888.cpp" new file mode 100644 index 0000000..1635df2 --- /dev/null +++ "b/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/14888.cpp" @@ -0,0 +1,65 @@ +#include +#include +#include + +using namespace std; + +int N; +int operand[11]; +int op[4]; +int MIN=1000000001; +int MAX=-1000000001; + +void getResult(int result, int idx){ + if(idx==N){ + if(result>MAX){ + MAX=result; + } + if(result0){ + op[i]--; + switch(i){ + case 0:{ + getResult(result+operand[idx], idx+1); + break; + } + case 1:{ + getResult(result-operand[idx], idx+1); + break; + } + case 2:{ + getResult(result*operand[idx], idx+1); + break; + } + case 3:{ + getResult(result/operand[idx], idx+1); + break; + } + } + op[i]++; + + } + } + return; +} +int main(){ + + cin >> N; + + for(int i=0; i> operand[i]; + } + for(int j=0; j<4; j++){ + cin >> op[j]; + } + getResult(operand[0], 1); + cout << MAX << "\n"; + cout << MIN << "\n"; + + return 0; +} \ No newline at end of file diff --git "a/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/15665.cpp" "b/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/15665.cpp" new file mode 100644 index 0000000..8488441 --- /dev/null +++ "b/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/15665.cpp" @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +using namespace std; +#define MAX 9 + +int N,M; +int input[MAX]; +int arr[MAX]; +set> s; + +void dfs(int k) { + if(k==M) { //끝 + vector v; + for(auto i=0;i> N >> M; + + for(int i=0;i> input[i]; + + sort(input,input+N); + + dfs(0); + + for(auto vector:s) { + for(auto temp:vector) + cout << temp << " "; + cout << "\n"; + } +} \ No newline at end of file From 56273c0d8f9f6138b558edc76789cf25694089c9 Mon Sep 17 00:00:00 2001 From: lumiere-on Date: Thu, 18 Apr 2024 19:25:22 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[=EB=B0=B1=ED=8A=B8=EB=9E=99=ED=82=B9]=204?= =?UTF-8?q?=EC=9B=94=2018=EC=9D=BC=20=EC=B6=94=EA=B0=80=EC=A0=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\355\225\204\354\210\230/2477.cpp" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/2477.cpp" diff --git "a/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/2477.cpp" "b/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/2477.cpp" new file mode 100644 index 0000000..cc817f2 --- /dev/null +++ "b/09_\353\260\261\355\212\270\353\236\231\355\202\271/\355\225\204\354\210\230/2477.cpp" @@ -0,0 +1,37 @@ +#include + +using namespace std; + +pair li[12]; + +int findArea() { // 육각형 모양의 영역 너비를 구하는 함수 + int big_square; //사각형 중 큰 부분 + int small_square; //사각형 중 작은 부분을 의미. + for (int i = 0; i < 9; i++) { //for문을 돌아가며 외부 사각형과 내부 사각형의 너비를 갱신. + if (li[i].first == li[i + 2].first && li[i + 1].first == li[i + 3].first) { // 같은 방향이 한 칸을 건너뛰고 나타나는 형태이면 + big_square = (li[i].second + li[i + 2].second) * (li[i + 1].second + li[i + 3].second); // 전체 사각형 갱신 + small_square = li[i + 2].second * li[i + 1].second; // 작은 사각형(영역이 없는 구역 갱신) + } + } + return big_square - small_square; //큰사각형-작은 사각형을 빼주는 것을 최종 결과값으로 리턴. +} + +int main() { + int k; + cin >> k; //1m2의 넓이에 자라는 참외의 개수 + + int direction, length; + for (int i = 0; i < 6; i++) { + cin >> direction >> length; //방향과 길이를 입력받음. + li[i] = {direction, length}; //입력받은 방향과 길이를 pair로 묶어 배열에 저장. + } + + for (int i = 0; i < 6; i++) { //어디서부터 입력이 들어오는지 모르기 때문에 6개 변을 추가해줌 + li[i + 6] = li[i]; + } + + int area = findArea(); //결과값에 함수의 결과를 할당. + cout << k * area << "\n"; //1m^2에서 자라는 참외의 개수*너비를 곱해준 값이 참외가 자라는 총 개수 + + return 0; +} \ No newline at end of file