Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/27172
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
플레이어의 카드에 적힌 수로 다른 플레이어의 카드에 적힌 수를 나눴을 때, 나머지가 0이면 승리 -> 1점 획득
플레이어의 카드에 적힌 수가 다른 플레이어의 카드에 적힌 수로 나누어 떨어지면 패배 -> 1점 감점
🔍 풀이 방법
숫자가 1~1,000,000까지 가능해서 100만 크기의 배열을 만들고 그 값으로 카드의 index를 저장해둠.
그리고, 카드 하나씩 돌아가면서 에라토스테네스의 체로 배수의 숫자들을 방문.
만약 저장되어 있는 index가 0보다 크면 해당 플레이어의 점수--, 카드주인 플레이어의 점수++
⏳ 회고
방법을 알면 쉬운데, 숫자 배열의 값으로 인덱스를 저장하는 방법을 생각하지 못했다.