結果
| 問題 |
No.1895 Mod 2
|
| コンテスト | |
| ユーザー |
siganai
|
| 提出日時 | 2022-04-09 16:56:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 113 ms / 2,000 ms |
| コード長 | 759 bytes |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 79,044 KB |
| 最終ジャッジ日時 | 2024-11-29 16:35:39 |
| 合計ジャッジ時間 | 2,427 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
ソースコード
#!/usr/bin/env PyPy3
from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
import heapq
import functools
mod=10**9+7
import sys
input=sys.stdin.readline
t = int(input())
def count(x):
res = 0
if x >= 10 ** 7:
sq = int(math.sqrt(x) - 2)
while (sq + 1) ** 2 <= x:
sq += 1
else:
sq = int(math.sqrt(x))
res += sq
if x >= 10 ** 7:
dsq = int(math.sqrt(x//2) - 2)
while (dsq + 1) ** 2 * 2 <= x:
dsq += 1
else:
dsq = int(math.sqrt(x//2))
res += dsq
return res
for _ in range(t):
l,r=map(int,input().split())
ans = count(r) - count(l-1)
print(ans%2)
siganai