高尔夫代码:钻石图案 [英] Code Golf: Diamond Pattern

查看:94
本文介绍了高尔夫代码:钻石图案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按字符计数的最短代码,用于根据输入输出菱形图案.

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*\;

这篇关于高尔夫代码:钻石图案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆