Merge pull request #258 from xexyl/1994-imc

Format fixes in 1994/imc/README.md
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-04-02 16:48:52 -07:00
commit 50dba270dc
1 file changed
+14 -12
+14 -12
View File
@@ -11,23 +11,25 @@
make all make all
## To run ## To run:
To use: To use:
./imc INTEGER ./imc INTEGER
## Judges' comments ## Try:
Try:
./imc 3 ./imc 3
./imc 3 ./imc 3
./imc 4 ./imc 4
./imc 4 ./imc 4
./imc 6 ./imc 6
## Judges' comments:
This entry's algorithm is as magic as its output! This entry's algorithm is as magic as its output!
## Author's comments
## Author's comments:
This program may be compiled with an ANSI or K&R compiler. A few This program may be compiled with an ANSI or K&R compiler. A few
harmless warnings are displayed only if "gcc -Wall" is used. harmless warnings are displayed only if "gcc -Wall" is used.
@@ -45,7 +47,7 @@
maximum parameter is determined only by the amount of cpu time, virtual maximum parameter is determined only by the amount of cpu time, virtual
memory and display (or file) space available. memory and display (or file) space available.
SPOILER: ### SPOILER:
OK, so you have probably seen magic square printers before. But what OK, so you have probably seen magic square printers before. But what
about one that deals with even sizes as well as odd ones, or one that about one that deals with even sizes as well as odd ones, or one that
@@ -65,16 +67,16 @@
s(n,a,q,d): makes a magic square of order n when n equals 4. s(n,a,q,d): makes a magic square of order n when n equals 4.
e(n,a,q,d): makes a magic square of order n when n is even and at least 6. e(n,a,q,d): makes a magic square of order n when n is even and at least 6.
In the above, a (of type int*) points to an area of memory in which In the above, `a` (of type `int*`) points to an area of memory in which
the magic square will be stored and q (also of type int*) points to the magic square will be stored and `q` (also of type `int*`) points to
an area of memory of length at least n*sizeof(int) bytes which can be an area of memory of length at least `n*sizeof(int)` bytes which can be
used as a work space. Both a and q must be allocated by the caller. used as a work space. Both `a` and `q` must be allocated by the caller.
The integer parameter d, usually zero, indicates the length of a gap The integer parameter `d`, usually zero, indicates the length of a gap
which will be left between adjacent rows of the magic square. which will be left between adjacent rows of the magic square.
The square which is returned will (or should) be a permutation of the The square which is returned will (or should) be a permutation of the
numbers 1 to n*n in which all rows and columns and the two diagonals numbers 1 to `n*n` in which all rows and columns and the two diagonals
add up to n*(n*n+1)/2. add up to `n*(n*n+1)/2`.
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License: