Definite Game
Hazrat Ali
Chouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games.
He came up with the following game. The player has a positive integer nn. Initially the value of nn equals to vv and the player is able to do the following operation as many times as the player want (possibly zero): choose a positive integer x that x<N<n and x is not a divisor of nn, then subtract x from nn. The goal of the player is to minimize the value of n in the end.
Soon, Chouti found the game trivial. Can you also beat the game?
The input contains only one integer in the first line: v (1≤v≤109), the initial value of nn.
Output a single integer, the minimum value of nn the player can get.
8
1
1
1
Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = (n == 2) ? 2 : 1;
cout << ans << endl;
return 0;
}