Halfway There
시간 제한2초메모리 제한512 MB
n이 주어질 때마다 1부터 n-1까지 n과 서로소인 정수들의 중앙값을 구한다.
문제
Given an integer , find the median of the list of all integers from to that are coprime with .
Recall that integers and are called coprime if their greatest common divisor is 1. The median of a list is defined to be the -th element of if is even, and the -th element of if is odd. Here is assumed to be sorted in ascending order, denotes the length of , and indices are -based.
입력
Each test contains multiple test cases. The first line contains the number of test cases (). Description of the test cases follows.
The only line of each test case contains a single integer ().
출력
For each test case, print a single integer --- the median of the list of integers from to that are coprime with .