Universal Cup Judging System

Universal Cup

Límite de tiempo: 2.5 s Límite de memoria: 1024 MB Puntuación total: 100
Estadísticas

양의 정수 $n$이 주어진다. 매 턴마다 다음을 수행한다:

  1. $n$의 십진법 표현에서 숫자 $d$ 하나를 균등하게 선택한다.
  2. $n\leftarrow n\cdot(d+1)$로 설정하여 $n$을 갱신한다.

$n$이 $N$을 초과하는 데 걸리는 턴 수의 기댓값을 $998244353$으로 나눈 나머지를 계산하라.

입력

하나의 입력 파일에는 여러 테스트 케이스가 들어 있다.

입력의 첫 번째 줄에는 테스트 케이스의 수를 나타내는 정수 $T$ ($1\le T\le 200$) 하나가 주어진다.

각 테스트 케이스의 첫 번째 줄에는 두 정수 $n$과 $N$ ($1\le n\le N\le 10^{18}$)이 주어진다.

출력

각 테스트 케이스에 대해 답을 나타내는 정수 하나를 한 줄에 출력하라.

답이 항상 존재함을 증명할 수 있다.

예제

입력 1

3
1 10
1 100
1 1000

출력 1

3
4
942786340

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.