C#,109个字节
void a(){Console.Write("{0}{1}{0}{1}\n{1}{1}{0}{0}\n{0}{2}{0}{2}\n{2}{2}{0}{0}","Hare ","Krishna ","Rama ");}
相当直接,Console.Write
隐式地格式化字符串,并且使用Write
而WriteLine
不是不仅节省了4个字节,而且避免了尾随换行符。使用Unix风格的换行符所以通过改变窗口可能无法正常工作这么好,适用于Windows额外的6个字节\n
来\r\n
如果您更喜欢返回字符串的方法,则此方法将直接输出到控制台:
C#,118个字节
string a(){return string.Format("{0}{1}{0}{1}\n{1}{1}{0}{0}\n{0}{2}{0}{2}\n{2}{2}{0}{0}","Hare ","Krishna ","Rama ");}
或者,如果您需要一个完全独立且可编译的程序:
C#,135个字节
class A{static void main(){System.Console.Write("{0}{1}{0}{1}\n{1}{1}{0}{0}\n{0}{2}{0}{2}\n{2}{2}{0}{0}","Hare ","Krishna ","Rama ");}}
如果您将其设置A
为入口类,那么它应该可以作为已编译程序工作。