Submit Best Submissions All Submissions

417. Mastermind Developer

Problem Statement:
Chess is a software developer at Orange Labs Cairo. He worked on an internal project and finished his task too fast other than his teammates. He wrote N lines of code and he had some time to play around with his code, So he decided to play a game, in N rounds,

in the first round he will comment all the code. (affected lines 1,2,3,4,5,6,7 ... )
in the second round he will uncomment every other line (affected lines 2,4,6,8 ... )
in the third round he will give a visit to every third line and for each line if the line is commented, he will uncomment the line, and if the line is uncommented he will comment the line. (affected lines 3,6,9,12, ...)
And so on for the remaining rounds (the ith round starts from the ith element and flips every ith line)

Chess found his code still working!! So he decided to play this game again for N lines, and making N rounds on these lines, your task is to find the number of lines that will be commented in his code.

Input Format:
The first line contains an integer T, the number of test cases. Followed by T lines, each line contains a single integer between 5 and 100, inclusive, which is the number of lines in code n.

Output Format:
For each test case, you must print out the number lines of code that will be commented when the Chess play his game on N lines.

Sample Input:
2 5 9

Sample Output:
2 3

Added by: ksamykandil
Added at: 2015-08-28 13:30:00 UTC
Time Limit: 3 seconds
Partial score: No
Source:Orange - First Contest