Skip to content

Instantly share code, notes, and snippets.

@berpj
Last active April 15, 2016 21:18
Show Gist options
  • Save berpj/4fbd6afc7ffa7929da57ebdf199b39f6 to your computer and use it in GitHub Desktop.
Save berpj/4fbd6afc7ffa7929da57ebdf199b39f6 to your computer and use it in GitHub Desktop.
t = gets.strip.to_i
t.times do
count = 0
x = gets.strip.split.map(&:to_i)
y = Math.sqrt(x[0]).floor
z = Math.sqrt(x[1]).floor
count += 1 if y**2 == x[0]
y += 1
while (y**2 <= x[1]) do
count += 1
y += 1
end
puts count
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment