Skip to main content
Back to problems
Codeforces
Easy
Math
Game Theory
Simulation
Game With Sticks

Given a pile of sticks, determine which player wins under the game's fixed move rule.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.

A Game With Sticks

gfg
Problem Statement

Game With Sticks

Two players play a turn-based game starting with n sticks.

On each move, a player takes a fixed number of sticks according to the game rules. The players alternate turns, and the player who cannot make a legal move loses.

Your task is to determine whether the first player or the second player wins for the given starting number of sticks.

This is a small logic problem: identify the pattern in the winning positions and output the winner accordingly.

Input Format

  • A single integer n representing the initial number of sticks.

Output Format

  • Print the name of the winning player, typically First or Second, according to the game rules.

Constraints

  • 1 <= n is a positive integer.
  • Solve using the observed game pattern rather than exhaustive search.
Examples
Sample cases returned by the problem API.

Example 1

Input

1

Output

First

Explanation

With one stick, the first player can make the only legal move and win.

Example 2

Input

2

Output

Second

Explanation

The position is losing for the first player under the move rule, so the second player wins.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.