๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ“ ์•Œ๊ณ ๋ฆฌ์ฆ˜

(140)
[C++/BOJ] 2164 : ์นด๋“œ2 (Queue) https://www.acmicpc.net/problem/2164 ๋ฐฑ์ค€ ์‹ค๋ฒ„4ํ๋กœ ํ’€์–ด์•ผ ํ•œ๋‹ค๋†“์น˜๊ธฐ ์‰ฌ์šด ์กฐ๊ฑด -> 1์„ ์ž…๋ ฅํ•  ๋•Œ, 0์ด ์•„๋‹Œ 1์ด ๋‚˜์™€์•ผ ํ•จ. (ํ์— ์ตœ์†Œ 1๊ฐœ๋Š” ๋‚จ์•„์•ผ ํ•œ๋‹ค)  ๋‚˜์˜ ํ’€์ด#include#include#includeusing namespace std;int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n = 0; int answer = 0; queue q; cin >> n; for (int i = 1; i
[C++/BOJ] 2493 : ํƒ‘ (Stack) https://www.acmicpc.net/problem/2493 ๋ฐฑ์ค€ ๊ณจ๋“œ5์‰ฝ๋‹ค๊ณ  ์ƒ๊ฐํ•˜๋ฉด์„œ 2์ค‘๋ฐ˜๋ณต๋ฌธ์œผ๋กœ ์ผ๋Š”๋ฐ.. ์‹œ๊ฐ„์ดˆ๊ณผ ใ…‹ใ…‹์Šคํƒ์„ ์‚ฌ์šฉํ•ด์„œ ๋‚ฎ์€ ๊ฑด popํ•˜๊ณ , ์ˆ˜์‹  ํƒ‘๋งŒ ๋‚จ๊ฒจ๋‘์–ด์•ผ ํ•œ๋‹ค  ๋‚˜์˜ ํ’€์ด#include#include#include using namespace std;int main() // ์ด์ค‘๋ฐ˜๋ณต๋ฌธ ์“ฐ๋ฉด ์‹œ๊ฐ„์ดˆ๊ณผ๋‚จ{ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; int height; stack> st; // ์ธ๋ฑ์Šค, ๋†’์ด cin >> n; for (int i = 1; i > height; while(!st.empty()){ if(st.top().second
[C++/BOJ] 11660 : ๊ตฌ๊ฐ„ ํ•ฉ ๊ตฌํ•˜๊ธฐ 5 (DP) https://www.acmicpc.net/problem/11660  ๋ฐฑ์ค€ ์‹ค๋ฒ„1๊ทธ๋ƒฅ ํ’€์—ˆ๋‹ค๊ฐ€ ์‹œ๊ฐ„์ดˆ๊ณผ๋‚˜๊ธธ๋ž˜ ๋ญ์ง€ ์‹ถ์—ˆ๋Š”๋ฐ.. dp ๋ฌธ์ œ์˜€๋‹ค ใ…œใ…œindex 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๋ฉด ์ด๊ฒƒ์ €๊ฒƒ ๊ท€์ฐฎ๊ธฐ ๋•Œ๋ฌธ์— index 1๋ถ€ํ„ฐ ์ž…๋ ฅ์„ ๋ฐ›์œผ๋ฉด ํŽธํ•˜๋‹ค  ๋‚˜์˜ ํ’€์ด#include#includeusing namespace std;int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; int m; int num; int dp[1025][1025] = {0,}; int x1; int x2; int y1; int y2; cin >> n >> m; for (int i = 1; i > num; dp[i][j] = dp[i - 1][j] + dp[i..
[C++/SWEA] 1208. [S/W ๋ฌธ์ œํ•ด๊ฒฐ ๊ธฐ๋ณธ] 1์ผ์ฐจ - Flatten (D3) https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AV139KOaABgCFAYh&categoryId=AV139KOaABgCFAYh&categoryType=CODE&problemTitle=&orderBy=RECOMMEND_COUNT&selectCodeLang=CCPP&select-1=3&pageSize=10&pageIndex=1 SW Expert AcademySW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!swexpertacademy.com ezswea๋Š” ๋‚œ์ด๋„๊ฐ€ ๋“ค์‘ฅ๋‚ ์‘ฅ์ด๋ผ๋”๋‹ˆ ๋งž๋Š” ๋ง์ธ ๊ฒƒ ๊ฐ™๋‹ค์ด ๋ฌธ์ œ๋Š” D2๋ณด๋‹ค ์‰ฌ์šด๋“ฏ ๋‚˜์˜ ํ’€์ด#include#include#inc..
[C++/SWEA] 1859. ๋ฐฑ๋งŒ ์žฅ์ž ํ”„๋กœ์ ํŠธ (D2) https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AV5LrsUaDxcDFAXc&categoryId=AV5LrsUaDxcDFAXc&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=CCPP&select-1=3&pageSize=10&pageIndex=1 SW Expert AcademySW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!swexpertacademy.com ์•„๋งˆ ๊ทธ๋ฆฌ๋””? ๋ฌธ์ œ์ธ ๊ฒƒ ๊ฐ™๋‹ค๋ฐฐ์—ด์„ ์—ญ์ˆœ์œผ๋กœ ํƒ์ƒ‰ํ•˜๋ฉด์„œ max๊ฐ’์„ ๊ฐฑ์‹ ํ•˜๊ณ , ๊ทธ๋ณด๋‹ค ์ž‘์€ ๊ฐ’๋“ค์€ ๋นผ์ฃผ๋ฉด ๋œ๋‹ค (ํŒ๋งค ํ›„ ์ฐจ์ต..
[C++/SWEA] 21425. += (D2) https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AZD8K_UayDoDFAVs SW Expert AcademySW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!swexpertacademy.com sw expert academy๋‚œ์ด๋„ D2๋ฌธ์ œa์— b๋ฅผ ๋”ํ• ๋•Œ, ํ•ญ์ƒ ๋” ํฐ ์ˆ˜๋ฅผ ๋”ํ•˜๋ฉด ๋œ๋‹ค. ์ตœ๊ทผ์—๋Š” ํ•ญ์ƒ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค๋งŒ ํ’€์–ด์„œ ์ž…๋ ฅ ์ฝ”๋“œ ๋ถ€๋ถ„์ด ๋‚ฏ์„ค์–ด์กŒ๋‹ค๋‹ค์‹œ ์—ฐ์Šตํ•ด์•ผ์ง€!!  ๋‚˜์˜ ํ’€์ด#include #include using namespace std;int answer = 0;void add(int a, int b, int n, int cnt){ if(a + b > n){ an..
[C++/SWEA] 1215. [S/W ๋ฌธ์ œํ•ด๊ฒฐ ๊ธฐ๋ณธ] 3์ผ์ฐจ - ํšŒ๋ฌธ1 (D3) https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AV14QpAaAAwCFAYi&categoryId=AV14QpAaAAwCFAYi&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=CCPP&select-1=3&pageSize=10&pageIndex=2 SW Expert AcademySW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!swexpertacademy.com ํšŒ๋ฌธ..๋ฐ˜๋ณต๋ฌธ ์•ˆ์— ๋ณ€์ˆ˜ 2๊ฐœ ๋„ฃ๋Š”๊ฑฐ ์ฒ˜์Œ ํ•ด๋ด„ใ…‹ใ…‹ ์ด์ค‘๋ฐ˜๋ณต๋ฌธ๋ณด๋‹ค ๊น”๋”ํ•˜๊ธด ํ•˜๋‹ค๊ฐ€๋กœ ๊ฐฏ์ˆ˜ ๊ตฌํ•˜๊ณ , ์„ธ๋กœ ๊ฐฏ์ˆ˜ ๊ตฌํ•ด์„œ ๋”ํ•˜๊ธฐ ๋‚˜์˜ ํ’€์ด#inc..
[C++/SWEA] 1206. [S/W ๋ฌธ์ œํ•ด๊ฒฐ ๊ธฐ๋ณธ] 1์ผ์ฐจ - View (D3) https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AV134DPqAA8CFAYh&categoryId=AV134DPqAA8CFAYh&categoryType=CODE&problemTitle=&orderBy=RECOMMEND_COUNT&selectCodeLang=CCPP&select-1=3&pageSize=10&pageIndex=1 SW Expert AcademySW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!swexpertacademy.com ์ตœ๋Œ“๊ฐ’ ์•„์ด๋””์–ด ๋‚˜์˜ ํ’€์ด#include#include#includeusing namespace std;int main(int a..

728x90