255. Winsock 3 Beta
time limit per test: 0.25
memory limit per test: 65536
Recently one famous company "Macrohard" announced the new version of its well-known network API called WinSuck 3 Beta. Small company "Analogotron" where you work asks you to probe that radically new programming library for future usage in the new tele-broadcasting complex.
You entered the research stage three months ago and now you are completely depressed. Earlier you had worked with WinSock 2 and all seemed to be fine, but you absolutely can not understand the logic of data sending/receiving mechanism of the new library.
At the forum of software developers you learned that "Macrohard" implemented the low-level security system, so now when estabilishing connection it generates some positive integer K and uses it in the following way.
When you are sending data to ports in range from K+1 to 2K the firewall is not blocking it if there are exactly three non-zero bits in port number. Ports out of range are always blocked by the firewall. For proper usage of the library you need to know the security key K, so you send data to all available ports (in range from 0 to +infinity), and only M of them were not blocked.
Now you must find whether you can detect the number K exactly.
The first line of input contains single integer N - the number of tests (0<=N<=100). The following N lines contain tests descriptions (one line per test). Test description contains single integer M (0<=M<=2^31-1).
Output N lines (one line per test). Line should contain "YES" (without quotes) if you can exactly detect number K given such M, or "NO" (without quotes) in the other case.
|Resource:||Petrozavodsk Summer Training Sessions 2004
|Date:||August 25, 2004
|Server time: 2017-11-23 19:47:10||Online Contester Team © 2002 - 2016. All rights reserved.|