12345排序为32154,1234排序为2143即符合情况,不一定要完全reverse,因为原数据是一个环
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++)
{
int number = sc.nextInt();
System.out.println(calc(number));
}
}
static int calc(int number)
{
if (number % 2 == 0)
return number / 2 * (number / 2 - 1);
else
return (number - 1) * (number - 1) / 4;
}
}