Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[week 5] 주간 결산_연서 #16

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

[week 5] 주간 결산_연서 #16

wants to merge 10 commits into from

Conversation

Yeonseo-Jo
Copy link
Member

✨ 이번주 문제 풀이


📚 이번주 코테 공부 중 느낀점 / 배운 점

이번주는 스택/큐 문제를 많이 풀었네용! 뭔가 쉬우면서도 어려운 느낌...

  • level 1

    • [부족한 금액 계산]
      • 가우스 공식 :

      • 등차수열의 합 = {(첫 항 + 마지막 항) * (항의 개수)} / 2
      • 참고문서
  • level 2

    • [할인 행사]
      -> 슬라인딩 윈도우 형태로 순회하며 가능한 케이스를 판별하는 문제
      -> map 자료형을 사용해 구현
      -> 할인 품목들을 Map에 세팅하고, 원하는 품목의 수량과 할인 품목이 일치하면 true를 return하도록 구성
      -> '10'일 동안만 회원이 유지되므로 10개씩 배열 잘라서 판별
  • [N개의 최소공배수]
    -> 유클리드 호제법으로 최대공약수 구하기
    => 2개의 자연수(또는 정식) a, b에 대해서 a를 b로 나눈 나머지를 r이라 하면(단, a>b), a와 b의 최대공약수는 b와 r의 최대공약수와 같다.
    이 성질에 따라, b를 r로 나눈 나머지 r'를 구하고, 다시 r을 r'로 나눈 나머지를 구하는 과정을 반복하여 나머지가 0이 되었을 때 나누는 수가 a와 b의 최대공약수이다.
    -> 최대공약수로 최소공배수 구하기
    => 최소공배수 = 두 수의 곱 / 최대공약수

@Yeonseo-Jo Yeonseo-Jo self-assigned this Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant