22:16 8/4/25 Problem - A - Codeforces
|
QuanVanHoang | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN
PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS STANDINGS CUSTOM INVOCATION
Codeforces Round 1016 (Div. 3)
A. Ideal Generator Contest is running
time limit per test: 1 second
01:33:38
memory limit per test: 256 megabytes
Contestant
We call an array a, consisting of k positive integers, palindromic if
[a1 , a2 , … , ak ] = [ak , ak−1 , … , a1 ] . For example, the arrays [1, 2, 1] and [5, 1, 1, 5] are
palindromic, while the arrays [1, 2, 3] and [21, 12] are not.
We call a number k an ideal generator if any integer n (n ≥ k ) can be represented as the sum of → Submit?
the elements of a palindromic array of length exactly k . Each element of the array must be
greater than 0. Language: Python 3.13.2
Almost always, if you send a solution
on PyPy, it works much faster
For example, the number 1 is an ideal generator because any natural number n can be
generated using the array [n]. However, the number 2 is not an ideal generator — there is no Choose
Chọn tệp Không có …được chọn
file:
palindromic array of length 2 that sums to 3.
Determine whether the given number k is an ideal generator.
Input
The first line of the input contains one integer t (1 ≤ t ≤ 1000 ) — the number of test cases.
The first and only line of each test case contains one integer k (1 ≤ k ≤ 1000 ).
Output
For each number k , you need to output the word "YES" if it is an ideal generator, or "NO"
otherwise.
You may output "Yes" and "No" in any case (for example, the strings "yES", "yes", and
"Yes" will be recognized as a positive answer).
Example
input Copy
5
1
2
3
73
1000
output Copy
YES
NO
YES
YES
NO
Codeforces (c) Copyright 2010-2025 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Apr/08/2025 22:15:20UTC+7 (g1).
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions
Supported by
[Link] 1/2
22:16 8/4/25 Problem - A - Codeforces
[Link] 2/2