CF1081A.Definite Game

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 xx that x<nx \lt n and xx is not a divisor of nn, then subtract xx from nn. The goal of the player is to minimize the value of nn in the end.

Soon, Chouti found the game trivial. Can you also beat the game?

Chouti 正在参加一场编程竞赛。然而,在他通过了所有题目之后,他感到无聊,于是决定发明一些小游戏。

他设计了如下游戏:玩家拥有一个正整数 nn。初始时 nn 的值为 vv,玩家可以执行以下操作任意多次(也可以不执行):选择一个正整数 xx,满足 x<nx \lt n 且 xx 不是 nn 的约数,然后将 nn 减去 xx。玩家的目标是使最终的 nn 尽可能小。

很快,Chouti 发现这个游戏非常简单。你也能轻松通关吗?

输入格式

The input contains only one integer in the first line: vv (1≤v≤1091 \le v \le 10^9), the initial value of nn.

输入仅在第一行包含一个整数:vv(1≤v≤1091 \le v \le 10^9),即 nn 的初始值。

输出格式

Output a single integer, the minimum value of nn the player can get.

输出一个整数,即玩家能得到的 nn 的最小值。

输入输出样例

  • 输入#1

    8

    输出#1

    1
  • 输入#2

    1

    输出#2

    1

说明/提示

In the first example, the player can choose x=3x=3 in the first turn, then nn becomes 55. He can then choose x=4x=4 in the second turn to get n=1n=1 as the result. There are other ways to get this minimum. However, for example, he cannot choose x=2x=2 in the first turn because 22 is a divisor of 88.

In the second example, since n=1n=1 initially, the player can do nothing.

在第一个例子中,玩家可以在第一轮选择 x=3x=3,此时 nn 变为 55;接着在第二轮选择 x=4x=4,最终得到 n=1n=1。还有其他方式可以达到这一最小值。然而,例如,玩家不能在第一轮选择 x=2x=2,因为 22 是 88 的一个因数。

在第二个例子中,由于初始时 n=1n=1,玩家无法进行任何操作。

输入解题思路,AI测评打分。不知道怎么写?

首页