本文介绍了高尔夫代码:钻石图案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按字符计数的最短代码,用于根据输入输出菱形图案.
The shortest code by character count to output a a pattern of diamonds according to the input.
输入由3个正数组成,分别代表菱形的大小和网格的大小.
The input is composed of 3 positive numbers representing the size of the diamond and the size of the grid.
由带空格的ASCII字符/和\制成菱形.大小为1的钻石是:
A diamond is made from the ASCII characters / and \ with spaces. A diamond of size 1 is:
/\ \/网格的大小由钻石的宽度和高度组成.
The size of the grid consists from width and height of number of diamonds.
Input: 1 6 2 Output: /\/\/\/\/\/\ \/\/\/\/\/\/ /\/\/\/\/\/\ \/\/\/\/\/\/Input: 2 2 2 Output: /\ /\ / \/ \ \ /\ / \/ \/ /\ /\ / \/ \ \ /\ / \/ \/
Input 4 3 1 Output: /\ /\ /\ / \ / \ / \ / \ / \ / \ / \/ \/ \ \ /\ /\ / \ / \ / \ / \ / \ / \ / \/ \/ \/
代码计数包括输入/输出(即完整程序).
Code count includes input/output (i.e full program).
推荐答案Golfscript-50个字符
~@:3,[{[.3-~' '*\' '*'/'\.'\\'4$]2$*}%n*.-1%]*n*\;更多推荐
高尔夫代码:钻石图案
发布评论