问题 F: Perfect square number

内存限制:512 MB 时间限制:13 S
题面:传统 评测方式:文本比较 上传者:
提交:6 通过:0

题目描述

You have an array of n elements a1,,a2, ...... , an.

You have an operation that can modify the value of a certain position to any of the values in [1,300][1,300]. (You can only perform it once)

Find the maximum number of intervals that satisfy the interval sum is a Perfect square number.

输入格式

Each test contains multiple test cases. The first line contains the number of test cases T (T5). The description of the test cases follows.

The first line contains one integer n1 n300).

The second line contains n integers 1, a2, ..., an1ai300).

输出格式

For each test case, output the maximum number.

输入样例 复制

2
3
1 1 1
4 
1 2 3 4

输出样例 复制

4
5