Hanoi Tower Troubles Again! Maximum Time Limit: 2 Seconds Memory Limit: 65536 KB when People stopped moving discs from peg to peg after they know the number of steps needed to complete the entire task. but on the other hand, they didn't not stopped thinking about similar puzzles With the Hanoi Tower. mr. S got Ted a little game on it. the game consists of N pegs and a LOT of bils. the bils are numbered 1, 2, 3... the balllook ordinary, but they are actually magic. if the sum of the numbers on two bils is NOT a square number, they will push each other with a great force when they're too closed, so they can NEVER be put together touching each other. the player shoshould pla Ce one ball on the top of a peg at a time. he shoshould first try ball 1, then ball 2, then ball 3... if he fails to do so, the game ends. help the player to place as your bils as possible. you may take a look at the picture above, since it shows us a best result for 4 pegs. input The first line of the input contains a single integer T, indicating the number of test cases. (1 <= T <= 50) Each test case Contains a single integer N (1 <= N <= 50), indicating the number of pegs available. output For each test case in the input print a line containing an integer indicating the maximal number of bils that can be placed. print-1 if an infinite number of bils can be placed. sample Input 2425 Sample Output 11337 contains n columns, where beads are placed from the first column. The bead number starts from 1, and the sum of two adjacent beads on each column is required to be open. [Cpp] # include <stdio. h> # include <math. h> # include <string. h> int a [55]; int main () {int t; scanf ("% d", & t); while (t --) {memset (a, 0, sizeof (a); int n; scanf ("% d", & n); int poit = 1; int s = 1; while (1) {if (poit> n) break; if (a [poit] = 0) {a [poit] = s; s ++; poit = 1; continue ;} else {int B = a [poit] + s; int c = sqrt (B); if (c * c = B) {a [poit] = s; s ++; poit = 1; continue;} poit ++;} printf ("% d \ n", s-1);} return 0 ;}# include <stdio. h> # include <math. h> # include <string. h> int a [55]; int main () {int t; scanf ("% d", & t); while (t --) {memset (a, 0, sizeof (a); int n; scanf ("% d", & n); int poit = 1; int s = 1; while (1) {if (poit> n) break; if (a [poit] = 0) {a [poit] = s; s ++; poit = 1; continue ;} else {int B = a [poit] + s; int c = sqrt (B); if (c * c = B) {a [poit] = s; s ++; poit = 1; continue;} poit ++;} printf ("% d \ n", s-1);} return 0 ;}