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