diff options
author | Jack Sangdahl <[email protected]> | 2025-02-13 12:51:23 -0700 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-02-13 12:51:23 -0700 |
commit | 3950be91f9589567d8258c788e10a0dec758e659 (patch) | |
tree | b3aa21a45bf04463c13be47c1501743ee3f6ab67 /introductory_problems/readme.md | |
parent | 700f2303dfa3307117e8106215c146c419f426cc (diff) | |
download | cses-3950be91f9589567d8258c788e10a0dec758e659.tar.gz cses-3950be91f9589567d8258c788e10a0dec758e659.zip |
1071. number spiral
Diffstat (limited to 'introductory_problems/readme.md')
-rw-r--r-- | introductory_problems/readme.md | 7 |
1 files changed, 7 insertions, 0 deletions
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) |