Under construction

Still being built. Things may change

FreeCell

Time limit1sMemory limit256 MB

Summary
Decide whether a sorted pile of K cards can be moved using N free cells and M empty stacks.
Level

Easy3 of 10

Topics
Math
Solved
No attempts yet

Problem

FreeCell solitaire is mostly about sorting, just like computer science. The goal is to sort a deck of cards under a fairly convoluted set of rules.

The rules are these. A shuffled deck is laid out in eight stacks. Only the topmost card of a stack may be moved. A card of value vv may be moved onto another stack only if that stack is empty, or if its topmost card has the opposite color and value v+1v + 1. For instance, the three of hearts may be moved on top of the four of clubs. You also have four free cells, empty at the start. Each free cell holds at most one card, and that card moves under the same rules as a stack card.

Figure H.1 shows a few legal moves.

Figure H.1: legal moves for the three of hearts and the six of clubs

Most FreeCell computer games let you move a pile of cards at once, provided there are enough empty cells and empty stacks to reach the same position by moving the cards one at a time. In the figure above, the whole pile with 5, 4 and 3 can be moved onto the six of spades by parking 3 and 4 in free cells and on the empty stack.

You want to move a sorted pile of KK cards from one stack onto the top of another stack. The destination stack is not empty, and its topmost card has the right color and value. Ignore every other non-empty stack, because otherwise you would have to account for the color and value of the topmost card of each one, and that gets too complicated.

Even with those stacks ignored, you still have NN free cells and MM empty stacks. Is the move possible?

Input

The input holds several test cases. Each test case is one line with three integers NN, MM and KK separated by spaces. NN is the number of free cells, MM is the number of empty stacks, and KK is the size of the pile you are moving. This is a generalized form of FreeCell, so 0≤N,M≤50 \le N, M \le 5 and 0≤K≤1000 \le K \le 100. The input runs to the end of file.

Output

For each test case, print yes on its own line if a pile of KK cards can be moved using NN free cells and MM empty stacks, and no otherwise.

Examples2

  1. Example 1

    Input
    3 1 8
    
    Expected output
    yes
    
  2. Example 2

    Input
    3 1 9
    
    Expected output
    no