close

import java.util.Scanner;
public class UVa10276 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int times = input.nextInt();
        int towerN = 0, num = 1, temp = 0;
        boolean ns = true, find = false;
        for (int i = 0; i < times; i++) {
            towerN = input.nextInt();
            num = 1;
            int[] t = new int[towerN];
            int z = 0;
            while (z < towerN) {
                temp = t[z] + num;
                find = false;
                for (int j = 1; j * j <= temp; j++) {
                    if (j * j == temp || t[z] == 0) {
                        t[z] = num;
                        num++;
                        z = 0;
                        find = true;
                        break;
                    }
                }
                if (find != true) {
                    z++;
                }
            }
            System.out.println(num - 1);
        }
    }
}

 

arrow
arrow
    文章標籤
    UVa JAVA code
    全站熱搜
    創作者介紹
    創作者 蒼雨 的頭像
    蒼雨

    日常雜物間

    蒼雨 發表在 痞客邦 留言(0) 人氣()