PROBLEM LINK:
Setter: soumyadeep_21(abhi_inav | CodeChef User Profile for Abhinav Gupta | CodeChef)
Testers: inov_360, mexomerf
Editorialist: hrishik85
DIFFICULTY:
860
PREREQUISITES:
None
PROBLEM:
Given an integer N, we have to output if
- N can be represented as N = 2 \times X + 7 \times Y
- where X, Y \geq 0
EXPLANATION:
If you write out an example sequence of numbers [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] you realise that the only numbers which cannot be represented in the format required are [1, 3, 5].
For N \geq 7, all numbers can be represented in the format above.
TIME COMPLEXITY:
Time complexity is O(1).
SOLUTION:
Editorialist's Solution
t=int(input())
for _ in range(t):
N=int(input())
if N>=7:
print('YES')
else:
if N%2==0:
print('YES')
else:
print('NO')