問題一覧 > 通常問題

No.2699 Simple Math (Returned)

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 114
作問者 : Magentor / テスター : 👑 hamamu hirayuu_yc
お気に入りにしたユーザー ProblemId : 10433 / 自分の提出
問題文最終更新日: 2024-03-29 21:27:29
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 424 (順位表) の他の問題:

Problem Statement

Find the remainder when $10^N-1$ is divided by $10^M+1$. Since the answer can be very large, output it modulo $998244353$.

You are given $T$ test cases; solve each of them.

Constraints

  • All inputs are integers.
  • $1 \leq T \leq 2 \times 10^5$
  • For each test case, $1 \leq N,M \leq 10^{9}$

Input

The input is given from Standard Input in the following format. Here, $\text{case}_i$ represents the $i$-th test case.

$T$
$\text{case}_1$
$\text{case}_2$
$\vdots$
$\text{case}_T$

Each test case is given in the following format.

$N\ M$

Output

Print $T$ lines. The $i$-th line should contain the answer to the $i$-th test case.

Sample

Sample 1
Input
3
4 1
8 3
33 4
Output
0
99
9
  • For the $1$-st test case, the remainder when $10^4-1=9999$ is divided by $10^1+1=11$ is $0$.
  • For the $2$-nd test case, the remainder when $99999999$ is divided by $1001$ is $99$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。