본문 바로가기 메뉴 바로가기

호로록

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

호로록

검색하기 폼
  • 분류 전체보기 (193)
    • MFC (0)
    • 알고리즘 (122)
      • C++ (93)
      • C (29)
    • 클라우드 (0)
    • django project (42)
      • 커뮤니티 (10)
      • 쇼핑몰 (11)
      • 블로그 (13)
      • 인스타그램 (7)
    • python (11)
    • 아무거나 (0)
    • git Error Handling (1)
    • 데이터 시각화 (12)
  • 방명록

알고리즘 (122)
[C++] 프로그래머스 프렌즈 4블록

#include using namespace std; int solution(int m, int n, vector board) { int answer = 0; vector check(m, vector(n, 0)); int i, j; while(true){ int escape_flag = 0; // 4*4 블록되는 부분 찾고 answer += 4 for(i = 0;i while문 탈출 if(escape_flag == 0) break; // 4*4 블록에서 중복되는 부분 처리 // 중복되는 개수만큼 answer에서 빼준다. for(i = 0;i = 1) { answer = answer - (check..

알고리즘/C++ 2020. 3. 11. 15:36
[C++] 나의 알고리즘 노트

1. 입출력 빠르게 하는 법 #include 이 헤더파일 하나면 map, set, vector 다 됨 - DEV C++ : 도구 -> 컴파일러 설정 -> 컴파일러 추가 설정 체크 -> -std=c+=14 추가 - Visual Studio : C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include 경로 아래에 bits 폴더를 만든다. 그리고 stdc++.h 이름의 파일을 만들어서 아래의 내용을 복붙한다. 더보기 // -*- C++ -*- // Copyright (C) 2007-2014 Free Software Foundation, Inc. // // This file is part of th..

알고리즘/C++ 2020. 3. 11. 14:10
[C++] 프로그래머스 뉴스 클러스터링

틀린 코드 #include #include #include #include using namespace std; int solution(string str1, string str2) { int answer = 0; int i = 0; std::transform(str1.begin(), str1.end(),str1.begin(), (int(*)(int))tolower); std::transform(str2.begin(), str2.end(),str2.begin(), (int(*)(int))tolower); map news; string temp = ""; for(i = 0; i= 97 && str1[i] = 97 && str1[i+1] = 97 && str2[i] = 97 && ..

알고리즘/C++ 2020. 3. 10. 18:27
[C++] 프로그래머스 예상 대진표

#include #include using namespace std; int solution(int n, int a, int b) { int answer = 3; queue game; for(int i = 1; i a와 b의 번호도 바꿔줘야함 2. a와 b가 대결하는 경우 -> 몇 라운드인지 반환 3. a가 다른 사람이랑 대결하는 경우, b가 다른 사람이랑 대결하는 경우 -> a , b를 이기게 하고 a와 b의 인덱스 번호를 바꾼다. 4. 그냥 다른 사람인 경우 -> 어차피 누가 올라가던 다음 라운드에서의 인덱스 번호는 똑같으니까 next_round_index를 푸쉬한다.

알고리즘/C++ 2020. 3. 10. 16:06
[C++] 프로그래머스 영어 끝말잇기

#include #include #include #include using namespace std; vector solution(int n, vector words) { vector answer; map check; int word_index = 0; string pre_word = words[word_index]; check[pre_word] += 1; string now = ""; while(true){ word_index += 1; if(word_index == words.size()) break; now = words[word_index]; if(now.length() == 1 || pre_word[pre_word.length()-1] != now[0] || check[now] != 0){ //..

알고리즘/C++ 2020. 3. 10. 15:15
[C++] 프로그래머스 점프와 순간이동

#include using namespace std; int solution(int n) { int ans = 0; int temp = n; while(temp != 0){ if(temp % 2 == 0){ temp = temp/2; } else{ temp = temp -1; ans += 1; } } return ans; } 짝수면 무조건 2로 나누고, 홀수면 짝수가 나올 때 까지 1을 뺀다. 1을 빼면서 배터리 사용량 ans도 1 증가시킨다. 이런 과정을 temp 가 0이 될 때 까지 반복한다.

알고리즘/C++ 2020. 3. 10. 14:13
[C++] 프로그래머스 소수 만들기

#include using namespace std; int answer = 0; vector value; void dfs(int index, int sum, int level){ if(level == 3){ int flag = 0; for(int i = 2; i*i

알고리즘/C++ 2020. 3. 9. 15:38
[C++] 프로그래머스 짝지어 제거하기

#include using namespace std; int solution(string s) { int index = 0; while(s.length() !=0 && s[index] != '\0'){ if(s[index] == s[index+1]){ s.erase(index, 2); if(index > 0) index -= 1; else index = 0; } else index += 1; } if(s.length() == 0) return 1; else return 0; } 테스트는 통과하는데 효율성에서 시간 초과가 떴다. 차아아아ㅏ암나 어떻게 하라는거지 프로그래머스는 좋은게 질문하기 게시판이 있어서 다른 사람들이 어떤걸 고민하고 어떻게 풀이했는지 보면서 힌트를 얻을 수 있다. 어떤 사람이 효율성에서..

알고리즘/C++ 2020. 3. 9. 15:18
이전 1 2 3 4 ··· 16 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • 테이블출력안됨
  • 장고 게시판
  • django clean
  • django tag
  • CellForRowAt Not Called
  • iOS 화면 안나옴
  • python 웹 배포
  • cleaned_data
  • 실시간 데이터베이스
  • ModelForm Form 차이
  • 데이터베이스 추천
  • django 로그인접근
  • iOS UITableView 출력안됨
  • iOS 데이터베이스
  • 장고 태그달기
  • UITableViewController Not Working
  • Django
  • 까만 화면
  • django 게시판
  • CellForRowAt 호출안됨
  • Firebase 데이터베이스 추천
  • django pythoneverywhere
  • 웹 배포
  • django 태그
  • pythonanywhere배포
  • django 개발일지
  • Realtime Database
  • pythonanywhere배포방법
  • 알파벳 카운팅
  • iOS 검은 화면
more
«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바