数字螺旋
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目背景
翻译自 CSES-1071 题。
题目描述
数字螺旋是一个左上角有一个数字 的无限网格。下面是螺旋的前 层:
你的任务是找到第 行第 列的数字。假设网格从 开始编号。
输入格式
第一行输入一个整数 表示数据组数。
接下来有 行,每行输入两个整数 。
输出格式
对于每组数据,输出一行一个整数,表示第 行第 列的数字。
样例
3
2 3
1 1
4 2
8
1
15
说明/提示
。
CSES练习一 枚举、模拟、数学
- Status
- Done
- Problem
- 19
- Open Since
- 2025-5-1 0:00
- Deadline
- 2025-6-2 23:59
- Extension
- 24 hour(s)