Permutation Again
Practice
4.1 (56 votes)
Ad Hoc
Algorithms
Approved
Easy
Open
Problem
42% Success 19867 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code
Given an integer N. Find out the PermutationSum where PermutationSum for integer N is defined as the maximum sum of difference of adjacent elements in all arrangement of numbers from 1 to N.
NOTE: Difference between two elements A and B will be considered as abs(A-B) or |A-B| which always be a positive number.
Input:
First line of input contains number of test case T. Each test case contains a single integer N.
Output:
For each test case print the maximum value of PermutationSum.
Constraints:
1<=T<=10000
1<=N<=105
Submissions
Please login to view your submissions
Similar Problems
Points:20
109 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyMathNumber TheoryOpen
Points:20
42 votes
Tags:
ApprovedCombinatoricsEasyMathOpenOthers
Points:20
32 votes
Tags:
ApprovedCombinatoricsEasyImplementationMathOpen
Editorial