아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Guessing Primes

면접 대비

시간 제한10초메모리 제한2048 MB

요약
다섯 자리 비밀 소수를 여섯 번의 추측 안에 찾아야 한다. 각 추측은 자리마다 초록, 노랑, 흰색 피드백을 받는다.
난이도

보통10점 중 7점

유형
정수론, 구현, 완전 탐색, 수학
정답자
아직 제출이 없습니다

문제

Your friends are all on board with the hype of a popular game, where you need to guess a five-letter word in six tries. Unfortunately, your language skills are not the greatest, so this game is not really your cup of tea. However, your mathematics skills greatly outmatch your friends', so you start playing a game called "Brave Alternative Primes Challenge" (Original at https://converged.yt/primel/.) instead. In order to show off your skills to your friends, you decide to write a program that will always beat the game.

In this game, you need to guess a secret prime number of five digits (i.e., between 10410^4 and 10510^5) in six turns. After guessing a prime number, you will receive a response consisting of five characters, each corresponding to a single digit in your guess:

  • "g" (green) means you guessed the corresponding digit correctly;
  • "y" (yellow) means that the digit is present in a position that is not yet green, but not at this position;
  • "w" (white) means that this digit is neither green nor yellow.

Note that the interactor colours at most one of your guessed digits per digit in the secret answer. If your guess includes more occurrences of a digit than the answer, only some of them will be green or yellow.

You win the game when the response is green for all five digits.

예제1

  1. 예제 1

    입력
    2
    
    ywyww
    
    wwwyg
    
    gggww
    
    ggggg
    
    wwwwy
    
    wgwgw
    
    ggggg
    
    예상 출력
    
    54323
    
    98737
    
    31583
    
    31517
    
    99991
    
    44449
    
    14143