From 3950be91f9589567d8258c788e10a0dec758e659 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Thu, 13 Feb 2025 12:51:23 -0700 Subject: 1071. number spiral --- introductory_problems/readme.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'introductory_problems/readme.md') diff --git a/introductory_problems/readme.md b/introductory_problems/readme.md index 2c2e44a..80fb417 100644 --- a/introductory_problems/readme.md +++ b/introductory_problems/readme.md @@ -34,3 +34,10 @@ A permutation of integers `1, 2, ..., n` is called beautiful if there are no adj **Input**: The only input line contains an integer `n`. (Example: 5) **Output**: Print a beautiful permutation of integers. If there are several solutions, you may print any of them. If there are no solutions, print "NO SOLUTION". (Example: 4 2 5 3 1) + +### Number Spiral +A number spiral is an infinite grid whose upper-left square has number 1. Your task is to find out the number in row `y` and column `x`. + +**Input**: The first imput line contains an integer `t`: the number of tests. After this, there are `t` lines, each containing integers `y` and `x`. (Example: 3`\n`2 3`\n`1 1`\n`4 2) + +**Output**: For each test, print the number in row `y` and column `x`. (Example: 8 1 15) -- cgit v1.2.3