use strict; use warnings; use strict; use warnings; use POSIX 'ceil'; my $n = <>; chomp $n; my $cand = 1000000000; for (my $i = 0; $i < $n; $i++) { my ($a, $b) = split /[ \n]/, <>; my $c = sqrt($a) + sqrt($b); if ($c == ceil($c)) { print $c + 1, "\n"; } else { print ceil($c), "\n"; } }