분류 전체보기 (64) 썸네일형 리스트형 [2021년 3월] 맥북에서 MySQL Workbench 가 안열려요 downloads.mysql.com/archives/workbench/ MySQL :: Download MySQL Workbench (Archived Versions) Please note that these are old versions. New releases will have recent bug fixes and features! To download the latest release of MySQL Workbench, please visit MySQL Downloads. MySQL open source software is provided under the GPL License. downloads.mysql.com 아카이브 버전에 들어가서 8.0.20 버전으로 다운받으면 열립니다. 최신버전은 아직.. [백준] 1966: 프린터큐 프린터큐가 날 눈물짓게 해... 생각보다 구현이 사나워서 해답을 찾아보니 priority queue를 사용한 풀이가 나왔다. 그런데 생각보다 priority queue로 해결하는 것이 아닌, queue, priority queue를 2개 다 쓰길래 그냥 queue, vector로 구현했다. 원래는 priority queue에서 pair로 받아서 compare하는 부분을 정의해서 queue하나로 다 완성하고 싶었는데 우선 compare부분을 내가 정의하려고 하는것에서 실패했고, 출력순서를 신경써야 하기 때문에 한 큐에 해결이 불가능하긴 했다. priority_queue 쓰는거랑, vector에 저장해서 sort 하는거랑 큰 차이가 있는지는 모르겠다. (둘 중에 뭐가 더 빠를까?) 내가 짠 코드 #inclu.. [c++] using namespace std;를 쓰는게 왜 나쁜 습관인가요? using namespace std; 보다 std::cout, std::cin 사용을 권장한다. > 설명 당신이 foo와 bar이라는 이름을 가지 두개의 라이브러리를 사용한다 하자. foo에서는 blah()를 bar에서는 quux()를 사용한다고 하자. 그런데 어느날 bar 라이브러리가 업데이트 되어 blah()가 추가 되었다고 하자. 당신이 만약 bar의 blah()를 사용하려 한다면 수정에 꽤 많은 시간을 들여야 할 것이다. 아래와 같이 사용하였다면 수정할 필요가 없었을 것이다. using namespace foo; using namespace bar; foo:blah(); bar:blah(); bar:quux(); 출처 : stackoverflow.com/questions/1452721/why-is.. [백준] 1406번: 에디터 백준 문제는 시간초과나 메모리초과에 신경을 써야하는게 많은 것 같다. 이번 문제도 string과 cursor위치를 int로 체크해주면서 했더니, 시간초과가 떠서 list로 구현. 데이터의 삭제나 추가가 번번히 일어나는 경우는 string 보다는 list가 효과적이라는 사실을 깨달음. C++에서 list는 많이 안써봐서 낯설다. 내가 짠 코드 #include #include #include #include using namespace std; int main(void){ int N,i; char op[4]={'L','D','B','P'}; list data; list::iterator cursor = data.end(); string input,operand; getline(cin,input); for(i.. [백준] 9012: 괄호 stack을 이용해서 push, pop을 처음 구현했는데 자꾸 runtime 에러가 나고 돌아가지 않길래, 결국은 그냥 +1, -1을 이용한 카운팅으로 했다. 내가 짠 코드 #include #include #include using namespace std; int main(void){ int N,i,j,value; string input; scanf("%d\n",&N); for(i=0;i [백준] 10816: 숫자 카드 2 처음 생각은, 카드를 입력받으면서 카드 개수도 같이 세주는 것을 생각했는데, 카드 개수를 세기 위해서는 매번 위치를 찾아야해서 여기서 시간초과가 계속 뜬 듯 하다. 해법은 이진탐색을 이용해서, 일단 입력 받은 후에, sortinng 하고 lowerboudn, upperbounnd찾는것. 내가 짠 코드 #include #include #include using namespace std; vector deck; int N; int upperBound(int value); int lowerBound(int value); int main(void){ int i,value,idx; int upper,lower; scanf("%d",&N); for(i=0;i [백준] 11651번 : 좌표 정렬하기 2 C++ vector의 pair를 이용하고, sort에서 비교함수를 사용자 정의 하는 문제. 내가 짠 코드 #include #include #include using namespace std; bool comp(paira, pairb){ if(a.second == b.second) return a.first sets; scanf("%d",&N); for(i=0;i [LeetCode] Longest Word in Dictionary through DeletingSolution 중간중간 헷갈려서 조금 헤맸다. public안에 sort를 위한 bool을 추가했는데 앞에 static을 붙여야 돌아가더라. 왜 붙여야 하는지는 아직 이해 못함. 내가 짠 코드 class Solution { public: static bool sortWithLength(string a, string b){ return a.length()>b.length(); } string findLongestWord(string s, vector& d) { string ans; int ans_len=0; sort(d.begin(),d.end(),sortWithLength); int i,j,dPos,sPos; for(i=0;i 이전 1 ··· 3 4 5 6 7 8 다음