이모저모 블로그

           
  • 홈
  • 태그
  • 방명록
  • 분류 전체보기 (26)
    • 프로그래밍 이모저모 (22)
      • 프로그래밍 (22)
      • 기타 (0)
    • 게임 이모저모 (0)
    • 생각 이모저모 (2)
    • 여행 이모저모 (0)
백준 10828 - 스택

프로그래밍 이모저모/프로그래밍2019. 8. 14. 22:44

스택은 쉽다. 접시를 쌓아놓은 것과 같으므로. First In, First Out의 좋은 예시이다. class를 이용하여 구현해보았다. #include #include using namespace std; class stak { public: int length = 0; int Arr[10000]; void push(int num); int pop(); int top(); int size(); int empty(); }; void stak::push(int num) { stak::Arr[stak::length] = num; stak::length++; } int stak::pop() { if (length == 0) return -1; int top = Arr[length - 1]; length--; r..

백준 2750 - 수 정렬하기

프로그래밍 이모저모/프로그래밍2019. 8. 14. 22:17

퀵 소트를 만드는 문제. 퀵 소트의 정리는 내일 정리해서 올리자. #include #include using namespace std; vector Arr; void partition(int start, int end) { if (start > Arr.size() - 1 || end = end) return; int pivot = start; int i = start; int j = end; while (i Arr[pivot]) j--; while (Arr[i] > N; for (int i = 0; i > num; Arr.push_back(num); } partition(0, N-1); for..

백준 1920 - 수 찾기

프로그래밍 이모저모/프로그래밍2019. 8. 14. 21:16

푸는데는 결국 실패... 그냥 베껴서 해결하였다. 소스코드는 https://jaimemin.tistory.com/587 에서 가져와서 해결하였다. 왜 시간 초과가 뜬 것인지는 불명.

백준 1149 - RGB거리

프로그래밍 이모저모/프로그래밍2019. 8. 13. 21:46

거의 베껴온 수준... acc[0][0] acc[1][0] acc[2][0]은 각각 처음 들어온 RGB값이다. 그 후 acc[0][1], acc[1][1], acc[2][1]부터는 acc[0,1,2][i-1] 중 1. 본인이 입력받은 값(Arr[n][i])와 겹치는 색이 아닐 것 2. 남은 두 색의 acc값 중 작은 값 에 본인의 입력 값인 Arr[n][i]를 더하면 된다. 이런 식으로 누적 후 acc[0][n], acc[1][n], acc[2][n] 중 작은 값을 출력하면 된다 #include #include using namespace std; int main() { int N; cin >> N; int Arr[3][1001]; for (int i = 1; i > Arr[0][i] >> Arr[1][..

백준 2003 - 수들의 합

프로그래밍 이모저모/프로그래밍2019. 8. 12. 22:45

#include using namespace std; int main() { int N, M; cin >> N >> M; int Arr[10000]; for (int i = 0; i > Arr[i]; } int count = 0; for (int i = 0; i

백준 1735 - 분수 합

카테고리 없음2019. 8. 12. 22:37

#include using namespace std; int main() { int N, M, O, P; cin >> N >> M >> O >> P; int temp1, temp2; temp1 = (N * P) + (M * O); temp2 = M * P; int res1 = temp1; int res2 = temp2; if (temp1

백준 1037 - 약수

프로그래밍 이모저모/프로그래밍2019. 8. 12. 22:06

#include #include #include using namespace std; int main() { long long int N; cin >> N; vector arr; int temp; for (int i = 0; i > temp; arr.push_back(temp); } sort(arr.begin(), arr.end()); cout

백준 1789 - 수들의 합

프로그래밍 이모저모/프로그래밍2019. 8. 8. 21:36

#include using namespace std; int main() { long long unsigned int N; cin >> N; long long unsigned int acc = 0; int i = 1; for (i = 1; acc + i

‹ Prev 1 2 3 4 Next ›

카테고리

  • 분류 전체보기 (26)
    • 프로그래밍 이모저모 (22)
      • 프로그래밍 (22)
      • 기타 (0)
    • 게임 이모저모 (0)
    • 생각 이모저모 (2)
    • 여행 이모저모 (0)

공지사항

최근에 올라온 글

최근에 달린 댓글

«   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

글 보관함

방문자

전체 :

오늘 :

어제 :

  • 홈
  • 태그
  • 방명록

Copyright © 이모저모 블로그 / designed by dev.golrazo.com

티스토리툴바