Banner Home Page Web Contests Problems Ranklist Status Statistics

Crosses and Crosses

Time Limit : 6000/3000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other)
Total Submission(s) : 1   Accepted Submission(s) : 1
Problem Description

The game of Crosses and Crosses is played on the field of 1 ¡Á n cells. Two players make moves in turn. Each move the player selects any free cell on the field and puts a cross ¡®¡Á¡¯ to it. If after the player¡¯s move there are three crosses in a row, he wins.

You are given n. Find out who wins if both players play optimally.

 

Input
<p>Input file contains one integer number <i>n</i> (3 ¡Ü <i>n</i> ¡Ü 2000).</p>
 

Output
<p>Output ¡®<tt>1</tt>¡¯ if the first player wins, or ¡®<tt>2</tt>¡¯ if the second player does.</p>
 

Sample Input
<table style="border-color: black; border-collapse: collapse;" border="1"><tr><th>#1</th><td>3</td></tr><tr><th>#2</th><td>6</td></tr></table>
 

Sample Output
<table style="border-color: black; border-collapse: collapse;" border="1"><tr><th>#1</th><td>1</td></tr><tr><th>#2</th><td>2</td></tr></table>
 

Source
PKU
 

Statistic | Submit | Back