問題一覧 > 通常問題

No.1915 Addition

レベル : / AI推定難易度 : 1025 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 202
作問者 : とりゐ / テスター : karinohito riano
お気に入りにしたユーザー ProblemId : 7489 / 自分の提出
問題文最終更新日: 2022-04-25 23:33:17
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 341 (順位表) の他の問題:

Problem Statement

You are given a positive integer $N$ that is at least $1$ and less than $10^9$. Find one positive integer $M$ that satisfies the following conditions.

  • $1\leq M\lt 10^{18}$
  • Let $A$ be $N+M$ under integer addition and $B$ be $N+M$ under string addition. Then $A$ divides $B$.
It can be shown that such an $M$ always exists.

You are given $T$ test cases.

Here, $N+M$ under string addition means the integer obtained by writing $N$ and $M$ side by side in this order and regarding the result as $1$ integer.

Input

$T$
$case_1$
$\vdots$
$case_T$
Each case is given in the following format.
$N$

  • $1\leq T\leq 100$
  • $1\leq N\lt10^9$
  • All input values are integers.

Output

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

Also, do not add leading zeros to your output. Adding leading zeros results in Wrong Answer.

Sample

Sample 1
Input
3
2
10
100
Output
1
35
10

  • For the $1$st test case, when $N,M=2,1$, we have $A=2+1=3,B=$ "2"+"1" $=21$. In this case, $A\times7=B$, so $A$ divides $B$.
  • For the $2$nd test case, when $N,M=10,35$, we have $A=10+35=45,B=$ "10"+"35" $=1035$. In this case, $A\times23=B$, so $A$ divides $B$.
  • For the $3$rd test case, when $N,M=100,10$, we have $A=100+10=110, B=$ "100"+"10" $=10010$. In this case, $A\times91=B$, so $A$ divides $B$.

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