Match Sticks

ihumaunkabir Criterion 2022 Round 18
Limits 1s, 512 MB

Bob was playing with match sticks and discovered that he could create alphabets and numbers by arranging match sticks. He also found that he can quickly form arithmetic operators like addition (++), subtraction (-), and multiplication (×\times).

Now, Bob has created a game and asks Alice to play. Bob gives Alice NN match sticks and sets the rule like that; if Alice can form an equal number of addition (++) and subtraction (-) operators and precisely one multiplication operator (×\times), then Alice wins.


There will be several lines of input. Read until end of file (EOF). Each line of input contains an integer NN (4<N<1000004 < N < 100000), the number of match sticks.


For each NN, print “Yes” if Alice wins, else “No” without the quotes. Each answer must be separated by space or be on a separate line.



If we have 5 sticks, we can make exactly one multiplication (×\times), one addition (++) and one subtraction (-) operators.

If we have 6 sticks, we can make one multiplication (×\times) but not an equal number of addition (++) and subtraction (-) operators.


Login to submit.


76% Solution Ratio
AsevenxEarliest, 3M ago
Yasir_ArafatFastest, 0.0s
Azmee.639648Lightest, 0 B
SabbasachiSutradharShortest, 85B
Toph uses cookies. By continuing you agree to our Cookie Policy.