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

7541번 - StuPId 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 128 MB138786356.757%

문제

At DUT, the Dreamland University of Technology, all students have personal id, numbers with six or seven digits. But they’re not just any numbers. Only those that have a checksum with a zero as last digit can be valid ids.

Here’s how to compute the checksum of an id number. Multiply the digits from back to front (!) with repeating factors 9, 3, 7. Then simply add the products. Example:

id number : 1 3 9 0 2 7 2
factors : 9 7 3 9 7 3 9
products : 9 21 27 0 14 21 18

Here the checksum is 9+たす21+たす27+たす0+たす14+たす21+たす18 = 110. The last digit is zero, so the id is valid. Sometimes students have very bad handwriting and the teaching assistents have a hard time identifying the id’s. You’re asked to help in special cases, where exactly one digit is unreadable. In that case, the missing digit can be computed (there’s always exactly one correct digit, thanks to 9, 3 and 7 being relatively prime to 10). Note that the students always begin concentrated and thus the first digit will always be readable (and not zero).

입력

The first line contains the number of scenarios. Each scenario is a single line that contains an id number with one digit replaced by a question mark and with six or seven digits length.

출력

The output for every scenario begins with a line containing “Scenario #i:”, where i is the number of the scenario starting at 1. Then print a single line containing the correct id number. Terminate the output for the scenario with a blank line.

제한

예제 입력 1

4
13?0272
3?5678
345?78
314?592

예제 출력 1

Scenario #1:
1390272
Scenario #2:
335678
Scenario #3:
345778
Scenario #4:
3146592

힌트

출처

University > Tu-Darmstadt Programming Contest > TUD Contest 2005 (Single) 3번

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

출처

대학교 대회

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

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