Skip to main content
Commonmark migration
Source Link

#I'm always right

I'm always right

Given the following input:

  • A number consisting of decimal digits, the guess

  • A number consisting of decimal digits, the answer

You are to output a single natural number, the base, such that when you interpret the guess as a number in the base base, the distance between guess and answer is smaller than for any other choice of base.

To be clear,

  • answer is interpreted as base 10

  • guess is interpreted as base base

  • distance means absolute value

  • The base must be greater than the largest digit used. I.e. if 6 appears in the guess, you cannot output a base smaller than 7 because any base smaller than 7 does not use the symbol 6.

Motivation and Example

Your friend asks you a question like "What's the population of New York City?"

You have no clue, so you make a guess "1,400,000 people", you say.

He says "You're an idiot, the population is 8,550,405. You were so far off."

You then do some quick math in your head and say, "I wasn't that far off, I didn't realize you wanted base 10. I was using base 14. In base 10, I said 9,680,832, which wasn't that bad of a guess"

In this example

guess = 1400000 answer = 8550405 base = 14 

Test cases

Eventually maybe.

#I'm always right

Given the following input:

  • A number consisting of decimal digits, the guess

  • A number consisting of decimal digits, the answer

You are to output a single natural number, the base, such that when you interpret the guess as a number in the base base, the distance between guess and answer is smaller than for any other choice of base.

To be clear,

  • answer is interpreted as base 10

  • guess is interpreted as base base

  • distance means absolute value

  • The base must be greater than the largest digit used. I.e. if 6 appears in the guess, you cannot output a base smaller than 7 because any base smaller than 7 does not use the symbol 6.

Motivation and Example

Your friend asks you a question like "What's the population of New York City?"

You have no clue, so you make a guess "1,400,000 people", you say.

He says "You're an idiot, the population is 8,550,405. You were so far off."

You then do some quick math in your head and say, "I wasn't that far off, I didn't realize you wanted base 10. I was using base 14. In base 10, I said 9,680,832, which wasn't that bad of a guess"

In this example

guess = 1400000 answer = 8550405 base = 14 

Test cases

Eventually maybe.

I'm always right

Given the following input:

  • A number consisting of decimal digits, the guess

  • A number consisting of decimal digits, the answer

You are to output a single natural number, the base, such that when you interpret the guess as a number in the base base, the distance between guess and answer is smaller than for any other choice of base.

To be clear,

  • answer is interpreted as base 10

  • guess is interpreted as base base

  • distance means absolute value

  • The base must be greater than the largest digit used. I.e. if 6 appears in the guess, you cannot output a base smaller than 7 because any base smaller than 7 does not use the symbol 6.

Motivation and Example

Your friend asks you a question like "What's the population of New York City?"

You have no clue, so you make a guess "1,400,000 people", you say.

He says "You're an idiot, the population is 8,550,405. You were so far off."

You then do some quick math in your head and say, "I wasn't that far off, I didn't realize you wanted base 10. I was using base 14. In base 10, I said 9,680,832, which wasn't that bad of a guess"

In this example

guess = 1400000 answer = 8550405 base = 14 

Test cases

Eventually maybe.

Source Link
Liam
  • 3.2k
  • 11
  • 11

#I'm always right

Given the following input:

  • A number consisting of decimal digits, the guess

  • A number consisting of decimal digits, the answer

You are to output a single natural number, the base, such that when you interpret the guess as a number in the base base, the distance between guess and answer is smaller than for any other choice of base.

To be clear,

  • answer is interpreted as base 10

  • guess is interpreted as base base

  • distance means absolute value

  • The base must be greater than the largest digit used. I.e. if 6 appears in the guess, you cannot output a base smaller than 7 because any base smaller than 7 does not use the symbol 6.

Motivation and Example

Your friend asks you a question like "What's the population of New York City?"

You have no clue, so you make a guess "1,400,000 people", you say.

He says "You're an idiot, the population is 8,550,405. You were so far off."

You then do some quick math in your head and say, "I wasn't that far off, I didn't realize you wanted base 10. I was using base 14. In base 10, I said 9,680,832, which wasn't that bad of a guess"

In this example

guess = 1400000 answer = 8550405 base = 14 

Test cases

Eventually maybe.