title: "최대공약수와 최소공배수(2609)" category: 백준[Class-2] tags: [C++, JavaScript, 백준] date: "2021-03-19" 문제 링크 최대공약수와 최소공배수(2609) C++ #include #include using namespace std; int getGCD(int a, int b){ if(b==0) return a; else return getGCD(b, a%b); } // 문제 풀이 함수 void solution(){ int a, b; cin >> a >> b; int gcdAB = getGCD(a, b); int lcmAB = a*b/gcdAB; cout
title: "영화감독 숌(1436)" category: 백준[Class-2] tags: [C++, JavaScript, 백준] date: "2021-03-19" 문제 링크 영화감독 숌(1436) C++ const fs = require("fs"); // split 조절 const input = fs.readFileSync("dev/stdin").toString().trim().split("\n"); // 문제 풀이 const n= +input[0]; let cnt=0; let num=666; while(true){ if(num.toString().includes("666")){ cnt++; if(cnt===n) break; } num++; } console.log(num); JavsScript #inc..
title: "단어 정렬(1181)" category: 백준[Class-2] tags: [C++, JavaScript, 백준] date: "2021-03-19" 문제 링크 단어 정렬(1181) C++ #include #include #include #include using namespace std; bool cmp(string a, string b){ if(a.length()==b.length()) return a > n; string str; set _set; while(cin >> str){ _set.insert..
title: "체스판 다시 칠하기(1018)" category: 백준[Class-2] tags: [C++, JavaScript, 백준] date: "2021-03-19" 문제 링크 체스판 다시 칠하기(1018) C++ #include #include using namespace std; int getDiffCount(vector& board, int startY, int startX){ int diffCnt=0; string startW="WB"; string startB="BW"; for(int y=startY; y> m; string str; vector board; while(cin >> str){ board.push_back(str); } int minDiffCount=64; for(int i=0..
title: "달팽이는 올라가고 싶다(2869)" category: 백준[Class-2] tags: [C++, JavaScript, 백준] date: "2021-03-18" 문제 링크 달팽이는 올라가고 싶다(2869) C++ #include #include #include using namespace std; // 문제 풀이 함수 void solution(){ int a, b, v; cin >> a >> b >> v; if(v>a){ cout
title: "Hashing(15829)" category: 백준[Class-2] tags: [C++, JavaScript, 백준] date: "2021-03-18" 문제 링크 Hashing(15829) C++ #include #include using namespace std; // 문제 풀이 함수 void solution(){ int l; string str; cin >> l >>str; long sum=0; long mulR=1; for(int i=0; i
title: "부녀회장이 될테야(2775)" category: 백준[Class-2] tags: [C++, JavaScript, 백준] date: "2021-03-18" 문제 링크 부녀회장이 될테야(2775) C++ #include #include #include using namespace std; // 문제 풀이 함수 void solution(){ int t, k, n; cin >> t; // parsing vector Ks; vector Ns; while(cin >> k >> n){ Ks.push_back(k); Ns.push_back(n); } // 최대 층, 최대 호 수 int maxK = *max_element(Ks.begin(), Ks.end()); int maxN = *max_element(..