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

31950번 - Champernowne Substring 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 (추가 시간 없음) 2048 MB (추가 메모리 없음)72231735.417%

문제

The Champernowne string is an infinite string formed by concatenating the base-10 representations of the positive integers in order.

It begins 1234567891011121314...

It can be proven that any finite string of digits will appear as a substring in the Champernowne string at least once.

Given a string of digits and question marks, compute the smallest possible index that this string could appear as a substring in the Champernowne string by replacing each question mark with a single digit from 0ドル$ to 9ドル$. Each question mark can map to a different digit. Since this index can be large, print it modulo 998ドル,244円,353円$.

입력

The first line of input contains a single integer $t$ $(1 \leq t \leq 10),ドル which is the number of test cases.

Each of the next $t$ lines contains a string $s$ (1ドル \leq |s| \leq 25$) consisting of digits 0ドル$ to 9ドル$ or question marks.

출력

Output $t$ lines. For each test case in order, output a single line with a single integer, which is the smallest possible index where the string could appear as a substring in the Champernowne string, modulo 998ドル,244円,353円$.

제한

예제 입력 1

9
0
???1
121
1?1?1
??5?54?50?5?505?65?5
000000000000
?2222222
?3????????9??8???????1??0
9?9??0????????????2

예제 출력 1

11
7
14
10
314159
796889014
7777
8058869
38886

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2024 B번

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

출처

대학교 대회

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

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