eolymp
bolt
Try our new interface for solving problems
Məsələlər

Mink Carpet

Mink Carpet

Given a natural number \textbf{n}, determine whether or not the equation \textbf{(x -- y)(x^\{n--1\} + x^\{n--2\}y + x^\{n--3\}y^2 + ... + xy^\{n--2\} + y^\{n--1\}) = z^n} has a solution in which \textbf{x}, \textbf{y} and \textbf{z} are positive rational numbers. Recall that a rational number is a number that can be written as a fraction \textbf{a/b}, where \textbf{a} is an integer, and \textbf{b} is a natural number. For concreteness: \textbf{n = 1: Test x -- y = z} \textbf{n = 2: Test (x -- y)(x + y) = z^2} \textbf{n = 3: Test (x -- y)(x^2 + xy + y^2) = z^3} \textbf{...} For example, for \textbf{n = 2}, \textbf{x = 13/4}, \textbf{y = 3} and \textbf{z = 5/4} satisfy the equation. Therefore a solution exists for the case \textbf{n = 2}. \InputFile The first input line contains the number of test cases \textbf{N}, \textbf{1} ≤ \textbf{N} ≤ \textbf{50}. Each test case consists of a single line containing an integer \textbf{n}, \textbf{1} ≤ \textbf{n} ≤ \textbf{2000000000}. \OutputFile For each test case, print "\textbf{Yes}" on a single line if a solution for \textbf{(x, y, z)} exists for the given \textbf{n}. Otherwise print "\textbf{No}" on a single line.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
2
2
1337
Çıxış verilənləri #1
Yes
No
Mənbə University of Toronto 2010 ACM Tryout: Saturday, October 2, 2010