Take It or Double It

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

요약
x달러로 시작해 예산 d를 넘지 않는 동안 금액이 계속 두 배가 되고, 두 배로 만들면 d를 넘는 순간 첫 번째 사람의 선택을 출력한다.
난이도

쉬움10점 중 2점

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

문제

You are the host of a street experiment show called TOPC (Take Or Pass Challenge). In the show, you approach people one by one and offer them some money. Each person can either:

  • Take it: Accept the money and end the game.
  • Double it: Reject the money and ask you to double the amount and offer it to the next person.

The game starts with xx dollars. You go down the street and meet a random person. You would like to predict in advance what each of them will say — either “take” or “double”.

You have a limited budget of dd dollars in your pocket. If, at any point, a person’s decision could result in an amount strictly greater than your available funds dd, you must force the person to say “take it”, regardless of what they wanted to say. Taiwanese people are very kind-hearted, so whenever they have a choice, they would always say “double it” and pass the opportunity to others — unless they are forced to take the money.

Your task is to simulate the game and determine if the person you meet will take the money or double it and give it to the next person.

입력

The input contains two integers xx and dd.

출력

Output a string “take it” or “double it”.

제한

  • 1≤x≤d≤1091 ≤ x ≤ d ≤ 10^9

예제3

  1. 예제 1

    입력
    123 246
    
    예상 출력
    double it
    
  2. 예제 2

    입력
    345 678
    
    예상 출력
    take it
    
  3. 예제 3

    입력
    789 101112
    
    예상 출력
    double it