import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++)
{
int m = sc.nextInt();
int[] pegs = new int[m];
int max = 0;
while (true)
{
max++;
int j;
for (j = 0; j < m; j++)
{
if (pegs[j] != 0)
{
if (isSquare(max + pegs[j]))
{
pegs[j] = max;
break;
}
continue;
}
pegs[j] = max;
break;
}
if (j == m)
{
System.out.println(max - 1);
break;
}
}
}
}
static boolean isSquare(int number)
{
return (Math.sqrt(number) - (int) Math.sqrt(number)) == 0;
}
}
ZOJ-1239
最新推荐文章于 2018-06-09 11:22:35 发布