For the field of an even size there is a winning strategy for the second player. Namely, to paint a cell that is symmetrical with respect to the center of the field to the cell painted by the first player on the previous turn. After each turn of the second player the field is centrosymmetrical and so there is always a cell that can be painted that is symmetrical with respect to the center of the field to any cell that the first player can choose to paint.
.... 1... .1.. .... ....
.... .... .... 1... .1..
.... .... .... ...2 ..2.
.... ...2 ..2. .... ....
For the field of an odd size there is a winning strategy for the first player. Namely, on the first turn to paint the central cell, then to paint a cell that is symmetrical with respect to the center of the field to the cell painted by the second player on the previous turn. After each turn of the first player the field is centrosymmetrical and so there is always a cell that can be painted that is symmetrical with respect to the center of the field to any cell that the second player can choose to paint.
..... 2.... .2... ..2.. .....
..... ..... ..... ..... .2...
..1.. ..1.. ..1.. ..1.. ..1..
..... ..... ..... ..... ...1.
..... ....1 ...1. ..1.. .....
n为奇数时先手赢,否则后手赢
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#define maxn 100005
using namespace std;
typedef long long ll;
int main(){
ll n;
scanf("%I64d", &n);
if(n&1)
puts("1");
else
puts("2");
return 0;
}