問題一覧 > 通常問題

No.1918 Simple Math ?

レベル : / AI推定難易度 : 1900 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 37
作問者 : とりゐ / テスター : karinohito riano
お気に入りにしたユーザー ProblemId : 7061 / 自分の提出
問題文最終更新日: 2022-04-25 23:34:39
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

Find $\displaystyle \sum _{i=1}^N \lfloor \sqrt{ai} \rfloor$ modulo $10^9+7$. Here, $\lfloor x\rfloor$ denotes the largest integer not exceeding $x$.

You are given $T$ test cases.

Input

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

  • $1\leq T\leq 10$
  • $1\leq a\leq 10^6$
  • $1\leq N\leq 10^{12}$
  • All inputs are integers.

Output

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

Sample

Sample 1
Input
3
1 5
2 5
1000000 1000000
Output
7
10
666660886

  • For the $1$st test case, $\lfloor \sqrt{1} \rfloor+\lfloor \sqrt{2} \rfloor+\lfloor \sqrt{3} \rfloor+\lfloor \sqrt{4} \rfloor+\lfloor \sqrt{5} \rfloor=1+1+1+2+2=7$.
  • For the $2$nd test case, $\lfloor \sqrt{2} \rfloor+\lfloor \sqrt{4} \rfloor+\lfloor \sqrt{6} \rfloor+\lfloor \sqrt{8} \rfloor+\lfloor \sqrt{10} \rfloor=1+2+2+2+3=10$.
  • For the $3$rd test case, find the remainder when divided by $10^9+7$.

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