Logo
(追記) (追記ここまで)

32538번 - Battle of Nieuwpoort 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB69575281.250%

문제

The battle of Nieuwpoort occurred in the year 1600ドル$. This is famously easy to remember, because it ends in two zeros. Alas, not all historical events have been so obliging!

You suspect that the problem is with the fixation of historians on the decimal system. Maybe, given the year of another battle, there exists a small base (at most 16ドル$) in which this year would also be easy to remember?

입력

The input consists of:

  • One line with 4ドル$ tokens:
    • One integer $y$ (1ドル\leq y\leq 2024,ドル in base-10ドル$), the year of the battle.
    • Three words $w$ (2ドル\leq |w|\leq 20$), naming the battle. The words only consist of English letters (A-Z and a-z).

출력

If it is possible to rewrite the year to make it easier to remember, output this base $b$ (2ドル\leq b\leq 16,ドル in base-10ドル$) and the year written in base-$b$. Otherwise, output "impossible".

The year in base-$b$ must end with "00" and must not start with '0'.

Use letters 'a', 'b', 'c', etc. for the digits following '9' in bases higher than 10ドル$.

If there are multiple valid solutions, you may output any one of them.

제한

예제 입력 1

1600 Battle of Nieuwpoort

예제 출력 1

10 1600

예제 입력 2

625 Battle of Sarus

예제 출력 2

5 10000

예제 입력 3

1600 Battle of Sekigahara

예제 출력 3

8 3100

예제 입력 4

1815 Battle of Waterloo

예제 출력 4

11 1400

예제 입력 5

1859 Battle of Solferino

예제 출력 5

13 b00

예제 입력 6

1848 Battle of Bov

예제 출력 6

2 11100111000

예제 입력 7

1453 Fall of Constantinople

예제 출력 7

impossible

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2024 Preliminaries B번

  • 문제를 만든 사람: Timon Knigge
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /