https://school.programmers.co.kr/learn/courses/30/lessons/340210
ํ๋ก๊ทธ๋๋จธ์ค
SW๊ฐ๋ฐ์๋ฅผ ์ํ ํ๊ฐ, ๊ต์ก, ์ฑ์ฉ๊น์ง Total Solution์ ์ ๊ณตํ๋ ๊ฐ๋ฐ์ ์ฑ์ฅ์ ์ํ ๋ฒ ์ด์ค์บ ํ
programmers.co.kr
ํ๋ก๊ทธ๋๋จธ์ค ๋ ๋ฒจ 3, ์ ๋ต๋ฅ 19%
์ ์ง์ง ์ฝ๋๊ฐ ๋๋ฌด ๊ธธ์ด์ ธ์ ๋ณด๋ฅ
1์๊ฐ ๋์ ํ๋ํ๋ ๊ตฌํํ๊ณ ์๋๋ฐ ์ด๊ฒ ์๋ ๊ฒ ๊ฐ๋ค,,
๋ค์์ ๋ค์ ํ์ด๋ด์ผ๊ฒ ๋ค
์ง๋ฒ์ด๋๊น ๋ฑ์ฅํ๋ ์ซ์๋ณด๋ค ์์ ์ง๋ฒ์ ๋ถ๊ฐ๋ฅ -> ํ์ ๋ฒ์๋ฅผ ์ขํ ์ ์๋ค
+
stringstream์ด๋ผ๋ ๊ฒ ์์๋ค. ๋ฌธ์์ด์ splitํ๋ ๊ฒ ์ฒ๋ผ cin ํํ๋ก ๋ฐ๋ก ์ชผ๊ฐ๋ ๋ฐฉ๋ฒ!!
์ผ๋จ ์ด๊ฑธ๋ก ์ ์ผ ํจ์จ์ ์ธ ๋ฌธ์์ด ๋ถ๋ฆฌ๋ฅผ ํด๋์๋ค
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
using namespace std;
vector<string> solution(vector<string> expressions) {
vector<string> answer;
vector<int> possible; // ๊ฐ๋ฅํ ์ง๋ฒ push
vector<vector<string>> exlist;
string a, op, b, eq, c;
for(string ex: expressions){
// ๊ฐ ์ซ์, ๋ฌธ์ ์ถ์ถํ๊ธฐ
stringstream ss(ex);
ss >> a >> op >> b >> eq >> c;
vector<string> v = {a, op, b, eq, c};
exlist.push_back(v);
}
// .. ์๋ต
'๐ ์๊ณ ๋ฆฌ์ฆ > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[C++/PGS] Lv.4 : ์ง๊ฒ๋ค๋ฆฌ (์ด๋ถํ์) (0) | 2025.05.03 |
---|---|
[C++/PGS] Lv.1 : ๋์์ ์ฌ์๊ธฐ (PCCP ๊ธฐ์ถ๋ฌธ์ 1๋ฒ) (0) | 2025.05.02 |
[C++/PGS] [PCCP ๊ธฐ์ถ๋ฌธ์ ] 4๋ฒ - ์๋ ์์ง์ด๊ธฐ (1) | 2025.05.02 |
[C++/PGS] [PCCP ๊ธฐ์ถ๋ฌธ์ ] 1๋ฒ - ๋ถ๋ ๊ฐ๊ธฐ (0) | 2025.05.02 |
[C++/PGS] [PCCP ๋ชจ์๊ณ ์ฌ #1] 3๋ฒ - ์ ์ ๋ฒ์น ๐คฏ (0) | 2025.05.02 |