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

30903번 - Fixing Fractions 스페셜 저지다국어

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

문제

Maths is hard.[citation needed] But it could be easier! And the internet™ has found some excellent ways to make it easier. Take a look at the following true equations:

Following the patterns, we come to the conclusion that the following equation should also be true:\vspace{-0.75\baselineskip}

However, this is actually wrong in boring old standard maths. Therefore, we define a new kind of funky maths where it is allowed to cancel out digits on the left side of the equality sign. This surely will make everyone's life easier. Except yours, since you have to evaluate if two given fractions are equal in our new funky maths.

입력

The input consists of:

  • One line with four integers $a,ドル $b,ドル $c,ドル and $d$ (1ドル\leq a,b,c,d<10^{18}$), describing the two fractions $\frac{a}{b}$ and $\frac{c}{d}$.

출력

If there exist integers $a'$ and $b'$ obtained from $a$ and $b$ by cancelling out the same digits and with $\frac{a'}{b'} = \frac{c}{d}$ in standard mathematics, output "possible", followed by $a'$ and $b'$. Otherwise, output "impossible".

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

Note that neither $a'$ nor $b'$ is allowed to contain leading zeroes after cancelling digits.

제한

예제 입력 1

163 326 1 2

예제 출력 1

possible
1 2

예제 입력 2

871 1261 13 39

예제 출력 2

possible
87 261

예제 입력 3

123 267 12339 23679

예제 출력 3

impossible

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2023 F번

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

출처

대학교 대회

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

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