codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

630R.md (1315B)


      1 Source: https://codeforces.com/problemset/problem/630/R
      2 
      3 R. Game
      4 
      5 time limit per test
      6 
      7 0.5 seconds
      8 
      9 memory limit per test
     10 
     11 64 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.
     22 
     23 The game is played on a square field consisting of *n* × *n* cells. Initially all cells are empty. On each turn a player chooses and paint an empty cell that has no common sides with previously painted cells. Adjacent corner of painted cells is allowed. On the next turn another player does the same, then the first one and so on. The player with no cells to paint on his turn loses.
     24 
     25 The professor have chosen the field size *n* and allowed the student to choose to be the first or the second player in the game. What should the student choose to win the game? Both players play optimally.
     26 
     27 Input
     28 
     29 The only line of the input contains one integer *n* (1 ≤ *n* ≤ 1018) — the size of the field.
     30 
     31 Output
     32 
     33 Output number 1, if the player making the first turn wins when both players play optimally, otherwise print number 2.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 1
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 1
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 2
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 2
     59 ```