https://school.programmers.co.kr/learn/courses/30/lessons/181187?language=javascript
function solution(r1, r2) {
let result = 0;
for(let i = -r2; i <= r2; i++){
for(let j = -r2; j <= r2; j++){
if(i*i + j*j >= r1 * r1 && i*i + j*j <= r2*r2){
result++;
}
}
}
return result;
}
function solution(r1, r2) {
let answer = 0;
answer -= r2 - r1 + 1;
let R1 = BigInt(r1) * BigInt(r1);
let R2 = BigInt(r2) * BigInt(r2);
for(let x = 0; x <= r2; x++){
let xx = BigInt(x) * BigInt(x);
let t1, t2 = Math.floor(Math.sqrt(Number(R2 - xx)));
if(x < r1){
let td = Math.sqrt(Number(R1 - xx));
let ti = Math.floor(Math.sqrt(Number(R1 - xx)));
t1 = td > ti ? ti + 1 : ti;
} else {
t1 = 0;
}
answer += t2 - t1 + 1;
}
answer *= 4;
return Number(answer);
}