CF976B.Lara Croft and the New Game

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.

Lara is going to explore yet another dangerous dungeon. Game designers decided to use good old 2D environment. The dungeon can be represented as a rectangle matrix of n rows and m columns. Cell (x, y) is the cell in the x-th row in the y-th column. Lara can move between the neighbouring by side cells in all four directions.

Moreover, she has even chosen the path for herself to avoid all the traps. She enters the dungeon in cell (1, 1), that is top left corner of the matrix. Then she goes down all the way to cell (n, 1) — the bottom left corner. Then she starts moving in the snake fashion — all the way to the right, one cell up, then to the left to the cell in 2-nd column, one cell up. She moves until she runs out of non-visited cells. n and m given are such that she always end up in cell (1, 2).

Lara has already moved to a neighbouring cell k times. Can you determine her current position?

你可能听说过今年即将推出的《古墓丽影》系列新作。你也可能看过它的预告片。不过,你肯定错过了剧情的核心设定,因此让我来揭开这层神秘面纱。

劳拉将探索又一座危险的地牢。游戏设计师决定采用经典的二维环境。该地牢可表示为一个 $ n $ 行 $ m $ 列的矩形矩阵。坐标为 $ (x, y) $ 的格子表示第 $ x $ 行、第 $ y $ 列的格子。劳拉可以在四个方向(上、下、左、右)上,在相邻(即有公共边)的格子之间移动。

此外,她甚至已为自己选定了一条路径,以避开所有陷阱。她从矩阵左上角的格子 $ (1, 1) $ 进入地牢;接着一路向下,到达左下角的格子 $ (n, 1) $;然后开始以“蛇形”方式移动:先向右一直走到最右列,再向上移动一格,再向左一直走到第 2 列的格子,再向上移动一格……如此反复,直到所有未访问过的格子都被遍历完毕。题目所给的 $ n $ 和 $ m $ 满足:她最终一定停在格子 $ (1, 2) $。

目前劳拉已经向相邻格子移动了 $ k $ 次。你能确定她当前所在的位置吗?

输入格式

The only line contains three integers n, m and k (2 ≤ n, m ≤ 109, n is always even, 0 ≤ k < n·m). Note that k doesn't fit into 32-bit integer type!

唯一一行包含三个整数 nn、mm 和 kk(2 ≤ n, m ≤ 1092 \leq n, m \leq 10^9,且 nn 恒为偶数,0 ≤ k < n ⋅ m0 \leq k < n \cdot m)。注意:kk 无法用 32 位整数类型表示!

输出格式

Print the cell (the row and the column where the cell is situated) where Lara ends up after she moves k times.

打印 Lara 移动 k 次后最终所在的单元格(即该单元格所在的行和列)。

输入输出样例

  • 输入#1

    4 3 0

    输出#1

    1 1
  • 输入#2

    4 3 11

    输出#2

    1 2
  • 输入#3

    4 3 7

    输出#3

    3 2

说明/提示

Here is her path on matrix 4 by 3:

以下是她在 4 行 3 列矩阵中的路径:

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

首页