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

6958번 - Letter Arithmetic 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB2211950.000%

문제

A popular form of pencil game is to use letters to represent digits in a mathematical statement. An example is

 SEND
+MORE
-----
MONEY

which represents

 9567
+1085
-----
10652

Your task is to read in sets of three "words" and assign unique digits to the letters in such a way as to make the sum of the first two words equal to the third word.

입력

The input begins with a line containing a positive integer $n$ which is the number of test data sets. Each data set consists of three lines, each of which will contain one word with the third word being the sum of the first two. The words will contain no more than 20 uppercase letters.

출력

The output is to consist of $n$ sets of lines each containing the numeric representation of each word in the corresponding test data set. There will be exactly one correct solution for each data set. Leave an empty line after the output for each data set.

제한

예제 입력 1

2
SEND
MORE
MONEY
MEND
COPE
CONEY

예제 출력 1

9567
1085
10652
9567
1085
10652

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 1999 > CCC 1999 5번

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

출처

대학교 대회

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

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