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

30547번 - Modified Gray Code 다국어

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

문제

The Gray Code is a well-known binary sequence in which successive elements differ by only one bit, and the bit chosen to be switched yields the smallest normal binary value not yet used. The first element of the sequence is the binary sequence corresponding to 0. For example, the 3-bit Gray Code sequence is 000, 001, 011, 010, 110, 111, 101, 100. So the element at index 0 is 000, the element at index 4 is 110, and so on.

We want to modify the Gray Code so that successive elements differ by an even number of bits, but again the bits selected to be changed should yield the smallest normal binary value not yet used. We call this the even Gray code. Here are the first 3 elements of the 5-bit even Gray Code:

0 0 0 0 0 0
1 0 0 0 1 1 (2 bits switched – positions 1 and 2)
2 0 0 1 0 1 (2 bits switched – positions 2 and 3)

Given an index $K,ドル give the element at index $K$ in the 10-bit even Gray Code.

입력

The first line of input consists of an integer $N$ (1ドル\le N\le 500$), which is the number of queries that will be made. The remaining $N$ lines each contains a positive integer $K$ (1ドル \leq K \leq 500$) representing the index of the 10-bit even Gray Code.

출력

For each input query, print the 10-bit representation of the corresponding even Gray Code element. There may be leading 0's but there should be no spaces between the digits.

제한

예제 입력 1

1
2

예제 출력 1

0000000101

예제 입력 2

2
1
10

예제 출력 2

0000000011
0000010100

힌트

출처

ICPC > Regionals > North America > North Central North America Regional > 2023 North Central NA Regional Contest H번

  • 문제를 만든 사람: Charles Riedesel
(追記) (追記ここまで)

출처

대학교 대회

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

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