No.1895 Mod 2
タグ : / 解いたユーザー数 111
作問者 :
とりゐ
Problem Statement
For a positive integer $x$, define the function $f(x)$ by $f(x) =$ (the sum of the positive divisors of $x$).
You are given $2$ positive integers $L, \ R$ $(L \leq R)$. Find the remainder when $\displaystyle \sum_{k = L}^{R}f(k)$ is divided by $2$.
You are given $T$ test cases; solve each of them.
Constraints
- All input values are integers
- $1 \leq T \leq 10^4$
- $1 \leq L \leq R \leq 10^{15}$
Input
The input is given from standard input. The first line is given in the following format, where the line number is $1$.
$T$
Then, over the following $T$ lines, the $T$ test cases are given, each in the following format.
$L$ $R$
Output
Print $T$ lines. On the $i$-th line $(1 \leq i \leq T)$, print the answer to the $i$-th test case.
Print a newline at the end.
Sample
Sample 1
Input
6 1 4 2 5 2 2 123456 654321 123456789 987654321 1 1000000000000000
Output
1 0 1 0 1 1
$6$ test cases are given.
In test case $1$, $L = 1,\ R = 4$. Since $f(1) = 1, \ f(2) = 3, \ f(3) = 4, \ f(4) = 7$, the sum is $15$, and the remainder when divided by $2$ is $1$.
In test case $2$, $L = 2,\ R = 5$. Since $f(2) = 3, \ f(3) = 4, \ f(4) = 7, \ f(5) = 6$, the sum is $20$, and the remainder when divided by $2$ is $0$.
In test case $3$, $L = R = 2$. Since $f(2) = 3$, the remainder when divided by $2$ is $1$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。