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

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

(143)
[C++/PGS] Lv.0 : ๋“ฑ์ˆ˜ ๋งค๊ธฐ๊ธฐ https://school.programmers.co.kr/learn/courses/30/lessons/120882# ํ”„๋กœ๊ทธ๋ž˜๋จธ์ŠคSW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„programmers.co.kr  ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค - ๋“ฑ์ˆ˜ ๋งค๊ธฐ๊ธฐ ๋ฌธ์ œ ํ‰๊ท  ์—ฐ์‚ฐ ๊ณผ์ •์—์„œ ๋‚˜๋ˆ—์…ˆ์ด ๋“ค์–ด๊ฐ€๋Š”๋ฐ์†Œ์ˆซ์ ๊นŒ์ง€ ๋ณด๊ณ  ์ˆœ์œ„๋ฅผ ๊ตฌํ•ด์•ผ ํ•ด์„œint ๋Œ€์‹  double๋กœ ํ‰๊ท ์„ ๊ตฌํ•ด์•ผ ํ•œ๋‹ค!!!  ๋‚˜์˜ ํ’€์ด#include #include #include #include #include using namespace std;vector solution(vector> score) { vector answer; vector avg; vector sorted_avg;..
[C++/PGS] Lv.3 : ์ตœ๊ณ ์˜ ์ง‘ํ•ฉ (๋ฒกํ„ฐ, ์ˆ˜ํ•™) https://school.programmers.co.kr/learn/courses/30/lessons/12938# ํ”„๋กœ๊ทธ๋ž˜๋จธ์ŠคSW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„programmers.co.kr  ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๋ ˆ๋ฒจ 3.ํŠน๋ณ„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ํ•„์š”ํ•˜์ง€ ์•Š๊ณ , ์ˆ˜ํ•™์  ์ ‘๊ทผ์œผ๋กœ ํ•ด๊ฒฐํ•˜๋ฉด ๋œ๋‹ค.s/n (ํ‰๊ท )์— ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ๊ฐ’๋“ค์˜ ๋ฆฌ์ŠคํŠธ๊ฐ€ ์ตœ๋Œ€ ๊ณฑ์„ ๊ฐ€์ง„๋‹ค. ํžŒํŠธ) ์˜ˆ๋ฅผ ๋“ค๋ฉดs = 10, n = 3์ผ ๋•Œs/n = 3, s%n = 1์ด๋ฏ€๋กœ์ตœ๋Œ€ ๊ณฑ์„ ๊ฐ€์ง€๋Š” ๋ฆฌ์ŠคํŠธ๋Š” { 3, 3, 4 } ์ด๋‹ค.  ๋‚˜์˜ ํ’€์ด#include #include using namespace std;vector solution(int n, int s) { vector an..
[C++/PGS] Lv.3 : ์ˆซ์ž ๊ฒŒ์ž„ (๊ทธ๋ฆฌ๋”” Greedy) https://school.programmers.co.kr/learn/courses/30/lessons/12987# ํ”„๋กœ๊ทธ๋ž˜๋จธ์ŠคSW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„programmers.co.kr  ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๋ ˆ๋ฒจ 3 ๋ฌธ์ œ๊ทธ๋ฆฌ๋””๋กœ ํ•ด๊ฒฐํ–ˆ๋‹ค ์ค‘์š” ํฌ์ธํŠธ = ์ •๋ ฌ & ์กฐ๊ฑด์— ๋งž์ง€ ์•Š๋Š” ์š”์†Œ ์‚ญ์ œ   ๋‚˜์˜ ํ’€์ด#include #include #include #include using namespace std;int solution(vector A, vector B) { int answer = 0; // ๊ทธ๋ฆฌ๋””? o ์™„ํƒ? x sort(A.begin(), A.end(), greater()); sort(B.begin(),..
[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๊ฐ’์„ ๊ฐฑ์‹ ํ•˜๊ณ , ๊ทธ๋ณด๋‹ค ์ž‘์€ ๊ฐ’๋“ค์€ ๋นผ์ฃผ๋ฉด ๋œ๋‹ค (ํŒ๋งค ํ›„ ์ฐจ์ต..

728x90