#abc227a. A - Last Card

A - Last Card

Score : 100100 points

问题描述

我们将总共发放 KK 张卡片给编号为 1,2,,N1, 2, \ldots, NNN 个人。

从第 AA 号人开始,我们将按照以下顺序依次给人们分发卡片:A,A+1,A+2,,N,1,2,A, A+1, A+2, \ldots, N, 1, 2, \ldots。谁将得到最后一张卡片?

形式化地表述,当编号为 x(1x<N)x(1 \leq x < N) 的人得到一张卡片后,编号为 x+1x+1 的人会得到下一张卡片。在编号为 NN 的人得到一张卡片后,编号为 11 的人会得到下一张卡片。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

We will hand out a total of KK cards to NN people numbered 1,2,,N1, 2, \ldots, N.

Beginning with Person AA, we will give the cards one by one to the people in this order: A,A+1,A+2,,N,1,2,A, A+1, A+2, \ldots, N, 1, 2, \ldots. Who will get the last card?

Formally, after Person x(1x<N)x(1 \leq x < N) gets a card, Person x+1x+1 will get a card. After Person NN gets a card, Person 11 gets a card.

Constraints

  • 1N,K10001 \leq N,K \leq 1000
  • 1AN1 \leq A \leq N
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN KK AA

Output

Print a number representing the person who will get the last card.

Sample Input 1

3 3 2

Sample Output 1

1

The cards are given to Person 2,3,12, 3, 1 in this order.

Sample Input 2

1 100 1

Sample Output 2

1

Sample Input 3

3 14 2

Sample Output 3

3

update @ 2024/3/10 09:56:45