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

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

(6)
[Javascript(NodeJS)/Softeer] Lv1. A+B https://softeer.ai/practice/6295 Softeer - ํ˜„๋Œ€์ž๋™์ฐจ๊ทธ๋ฃน SW์ธ์žฌํ™•๋ณดํ”Œ๋žซํผ softeer.ai ํ˜„๋Œ€ ์†Œํ”„ํ‹ฐ์–ด Lv1. A+B js ํ’€์ด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”ํ…Œ ์‰ฝ์ง€์•Š๋‹ค๊ทธ๋ž˜๋„ ๊ฐœ๋ฐœ ์งฌ๋ฐ”๋กœ ์–ด์ฐŒ์–ด์ฐŒ ๊ทน๋ณตํ•˜๋Š”์ค‘..^-^const readline = require('readline');const rl = readline.createInterface({ input: process.stdin, output: process.stdout});let sum = 0;let result = [];rl.on('line', input =>{ arr = input.split(' ').map(el=>parseInt(el)); if(arr.length >1) { sum = a..
[Javascript(NodeJS)/Softeer] Lv1. ๊ทผ๋ฌด ์‹œ๊ฐ„ https://softeer.ai/practice/6254 Softeer - ํ˜„๋Œ€์ž๋™์ฐจ๊ทธ๋ฃน SW์ธ์žฌํ™•๋ณดํ”Œ๋žซํผ softeer.ai ํ˜„๋Œ€ ์†Œํ”„ํ‹ฐ์–ด Lv1. ๊ทผ๋ฌด ์‹œ๊ฐ„ js ํ’€์ด ๊ฐ‘์ž๊ธฐ ์ฝ”ํ…Œ ์‘์‹œ ์–ธ์–ด๊ฐ€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ผ๋Š” ๊ฑธ ์•Œ๊ฒŒ๋œ ๋‚˜๊ธ‰ํ•˜๊ฒŒ ์—ฐ์Šต๋ฌธ์ œ๋ฅผ ํ’€์–ด๋ณด๋Š”๋ฐ.....๊ทธ๋ƒฅ ๋„์ „ํ•˜๋Š”๊ฑฐ์ง€๋ญ~~~const readline = require('readline');const rl = readline.createInterface({ input: process.stdin, output: process.stdout});let sum = 0;min = 0;hour = 0;rl.on('line',input =>{ time = input.split(' '); timesp = time.map(t=>t.split('..
[C++/Softeer] Lv3. ์ˆœ์„œ๋Œ€๋กœ ๋ฐฉ๋ฌธํ•˜๊ธฐ (HSAT 7ํšŒ ์ •๊ธฐ ์ฝ”๋”ฉ ์ธ์ฆํ‰๊ฐ€ ๊ธฐ์ถœ) https://softeer.ai/practice/6246/history?questionType=ALGORITHM Softeer - ํ˜„๋Œ€์ž๋™์ฐจ๊ทธ๋ฃน SW์ธ์žฌํ™•๋ณดํ”Œ๋žซํผ softeer.ai ํ˜„๋Œ€ ์†Œํ”„ํ‹ฐ์–ด Lv3. ์ˆœ์„œ๋Œ€๋กœ ๋ฐฉ๋ฌธํ•˜๊ธฐ C++ ํ’€์ด ๋ฌธ์ œ ๋‚œ์ด๋„๋Š” ์ ์ ˆํ•ด๋ณด์ด๋‚˜, ์กฐ๊ฑด ์„ค๋ช…์ด ์•ฝ๊ฐ„ ์•„์‰ฌ์› ๋˜ ๋ฌธ์ œ.์ตœ๋‹จ๊ฑฐ๋ฆฌ๋Š” ์•„๋‹ˆ๊ณ  ๋ฐฉ๋ฌธํ–ˆ๋˜ ์นธ์„ ๋‹ค์‹œ ์ง€๋‚˜์ง€๋งŒ ์•Š์œผ๋ฉด ๋˜๋Š”๋“ฏ์ „์ฒด dfs ๊ฒฝ์šฐ ์ค‘, ์ˆœ์ฐจ์ ์œผ๋กœ ์ €์žฅ๋œ ์ง€์ ์„ ๊ฑฐ์น˜๋Š” ๊ฒฝ์šฐ๋งŒ์„ countํ•ด์„œ ํ•ด๊ฒฐํ–ˆ๋‹ค.#include#include #include using namespace std;int grid[4][4]={0,};int visited[4][4]={0,};int n; int m;vector> store;int dx[4] = {0,1,0,-1};int dy[4]..
[C++/Softeer] Lv2. ํšŒ์˜์‹ค ์˜ˆ์•ฝ https://softeer.ai/practice/6266 Softeer - ํ˜„๋Œ€์ž๋™์ฐจ๊ทธ๋ฃน SW์ธ์žฌํ™•๋ณดํ”Œ๋žซํผ softeer.ai ํ˜„๋Œ€ ์†Œํ”„ํ‹ฐ์–ด Lv2. ํšŒ์˜์‹ค ์˜ˆ์•ฝ C++ ํ’€์ด ์ฒซ ์ œ์ถœ์—์„œ Subtask 2๊ฐœ๊ฐ€ ์˜ค๋‹ต์œผ๋กœ ๋–ด๋‹ค. ์ œ์ผ ๊ฐ„๋‹จํ•œ ๋ฐ˜๋ก€ ํƒ์ƒ‰๋ฒ•์ธ ๋ธ”๋ž™๋ฐ•์Šค-๊ฒฝ๊ณ„๊ฐ’ ๋ถ„์„์œผ๋กœ ๋ฐ˜๋ก€๋ฅผ ์ฐพ์•„๋ณด์ž!-> ์•„๋ž˜ ์ผ€์ด์Šค์—์„œ, b๋Š” 17-18์ด ๊ฐ€๋Šฅํ•œ๋ฐ not available์ด ์ถœ๋ ฅ๋จ2 2a ba 9 10b 9 17 ๊ฐ€๋Šฅํ•œ ์‹œ๊ฐ„๋Œ€ pair๋ฅผ ๊ตฌํ•  ๋•Œ, ๋ฐ˜๋ณต๋ฌธ์ด ๋๋‚œ ๋’ค์— isAble true ์„ค์ •์„ ์•ˆํ•ด์ค˜์„œ ์ƒ๊ฒผ๋˜ ์˜ค๋ฅ˜.์ถ”๊ฐ€ํ•ด์คฌ๋”๋‹ˆ ํ†ต๊ณผ!!#include#include #include #include using namespace std;int main(int argc, char** argv){ int roo..
[C++/Softeer] Lv1. ์œ„ํ—˜ํ•œ ํšจ๋„ https://softeer.ai/practice/7368 Softeer - ํ˜„๋Œ€์ž๋™์ฐจ๊ทธ๋ฃน SW์ธ์žฌํ™•๋ณดํ”Œ๋žซํผ softeer.ai ํ˜„๋Œ€ ์†Œํ”„ํ‹ฐ์–ด Lv1. ์œ„ํ—˜ํ•œ ํšจ๋„ C++ ํ’€์ด ์–ด์ฉŒ๋‹ค ๋ณด๋‹ˆ ํšจ๋„ ์‹œ๋ฆฌ์ฆˆ๋งŒ ํ‘ธ๋Š”์ค‘์ด๋‹คใ…‹ใ…‹์›๋ž˜๋Š” ๋‚œ์ด๋„๊ฐ€ Lv2์˜€๋Š”๋ฐ Lv1๋กœ ๋‚ด๋ ค์˜จ ๋“ฏ.์•ž/๋’ค๋กœ ๊ฐˆ ๋•Œ, ์›€์ง์ž„/์ •์ง€ํ•  ๋•Œ์˜ ๊ฒฝ์šฐ๋งŒ ์ž˜ ๋‚˜๋ˆ„๋ฉด ์‰ฝ๊ฒŒ ์„ฑ๊ณตํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค!#includeusing namespace std;int main(int argc, char** argv){ int a; int b; int d; cin >> a >> b >> d; int now = 0; int time = 0; int cnt = 0; bool isCatch = false; while(1){ ..
[C++/Softeer] Lv3. ํ•จ๊ป˜ํ•˜๋Š” ํšจ๋„ https://softeer.ai/practice/7727 Softeer - ํ˜„๋Œ€์ž๋™์ฐจ๊ทธ๋ฃน SW์ธ์žฌํ™•๋ณดํ”Œ๋žซํผ softeer.ai ํ˜„๋Œ€ ์†Œํ”„ํ‹ฐ์–ด Lv3. ํ•จ๊ป˜ํ•˜๋Š” ํšจ๋„ C++ ํ’€์ด ๊ฝค๋‚˜ ๊นŒ๋‹ค๋กœ์› ๋˜ ๋ฌธ์ œ์ด๋‹ค.์ฝ”ํ…Œ ๊ณต๋ถ€๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•˜๋ฉด์„œ ์ฒ˜์Œ์œผ๋กœ ํ‘ผ ๋ฌธ์ œ์ธ๋ฐ,์—ด์‹ฌํžˆ ๊ณ ๋ฏผํ•˜๋ฉด์„œ ํ’€๋‹ค๋ณด๋‹ˆ ์˜ˆ์ „ ์‹ค๋ ฅ์ด ๊ธˆ๋ฐฉ ๋Œ์•„์˜จ ๋Š๋‚Œ์ด๋‹ค1. ์ดˆ์•ˆ(ํ…Œ์ผ€๋งŒ ๋งž์Œ)์บ๋ฆญํ„ฐ ๊ทผ์ฒ˜์˜ 4๋ฐฉํ–ฅ ํƒ์ƒ‰ ํ›„, max๊ฐ’์œผ๋กœ ์ด๋™ → 3์ดˆ ํ›„ ์ •์ง€ํ•˜๋„๋ก ํ•จ๊ทผ๋ฐ ์ž˜๋ชป๋œ ๋ฐฉ๋ฒ•์ด์—ˆ์Œ!!! 3๋ฒˆ ์ด๋™ํ•˜๋Š” ๋ชจ๋“  ๊ฒฝ์šฐ๋ฅผ ํƒ์ƒ‰ํ•˜๊ณ , ๊ทธ ์ค‘ max๊ฐ’์„ ์–ป๋Š” ๊ฒฝ์šฐ๋ฅผ ๋ฆฌํ„ดํ•ด์•ผํ•จgrid ๋ณต์‚ฌํ•ด์„œ ์—ฌ๋Ÿฌ๋ช… ์ง€๋‚˜๊ฐ€๋Š” ๋ฃจํŠธ ์ฒดํฌ, visited๋กœ ํ•œ๋ช… ์ง€๋‚˜๊ฐ€๋Š” ๋ฃจํŠธ ์ฒดํฌ์•„๋ž˜ ์ฝ”๋“œ๋Š” ๋น„๊ต์  ์‰ฌ์šด bfs๋กœ ๊ฒฝ๋กœ๋ฅผ ํƒ์ƒ‰ํ•œ ์ดˆ์•ˆ์ž…๋‹ˆ๋‹ค....ํ…Œ์ผ€๋Š” ๋งž์•˜์ง€๋งŒ ์ œ์ถœํ•ด๋ณด๋‹ˆ ์‹คํŒจ.์ˆ˜์ •ํ•˜๋‹ค๊ฐ€ d..

728x90