Logo
(追記) (追記ここまで)

24645번 - Halfway There 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB75574873.846%

문제

Given an integer $n,ドル find the median of the list of all integers from 1ドル$ to $n - 1$ that are coprime with $n$.

Recall that integers $a$ and $b$ are called coprime if their greatest common divisor is 1. The median of a list $L$ is defined to be the $\frac {|L|}{2}$-th element of $L$ if $|L|$ is even, and the $\frac {|L|+1}{2}$-th element of $L$ if $|L|$ is odd. Here $L$ is assumed to be sorted in ascending order, $|L|$ denotes the length of $L,ドル and indices are 1ドル$-based.

입력

Each test contains multiple test cases. The first line contains the number of test cases $t$ (1ドル \le t \le 10^3$). Description of the test cases follows.

The only line of each test case contains a single integer $n$ (2ドル \le n \le 10^{18}$).

출력

For each test case, print a single integer --- the median of the list of integers from 1ドル$ to $n - 1$ that are coprime with $n$.

제한

예제 입력 1

3
6
10
19

예제 출력 1

1
3
9

힌트

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2021-2022 North-Western Russia Regional Contest H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /