Buat program yang ketika dijalankan menampilkan teks di bawah ini:
)-*-*-*^_^*-*-*-(
| Welcome User! |
)-*-*-*^_^*-*-*-(
Gunakan fungsi atau bahasa apa saja untuk menjawab ini, bersenang-senanglah. Kode terpendek menang
Buat program yang ketika dijalankan menampilkan teks di bawah ini:
)-*-*-*^_^*-*-*-(
| Welcome User! |
)-*-*-*^_^*-*-*-(
Gunakan fungsi atau bahasa apa saja untuk menjawab ini, bersenang-senanglah. Kode terpendek menang
Jawaban:
Japt ,
4139 byteDisimpan 2 byte berkat @Shaggy
Penjelasan:
Cobalah online!
sumber
Python 2 , 54 byte
Cobalah online!
sumber
T-SQL, 60 byte
SQL memungkinkan pemisahan string literal melalui baris, sehingga pengembaliannya dihitung.
Bekerja pada solusi prosedural, tetapi ragu saya akan menemukan satu di bawah 60.
Sunting Baru : Ditemukan yang sederhana
REPLACE
yang mengikat solusi sepele:Ternyata itu
REPLACE
akan melakukan konversi angka secara implisit ke string, jadi ini memungkinkan saya menyimpan 2 karakter dengan menghilangkan tanda kutip di sekitar karakter pengganti saya.Mencoba memasukkannya ke dalam variabel terlalu lama, karena overhead
DECLARE
(69 byte):sumber
Python 2.7, 55 byte
Cukup mudah. Termasuk baris baru yang memimpin dan tertinggal.
sumber
C (gcc) ,
7875 byteCobalah online!
sumber
#define P puts(")-*-*-*^_^*-*-*-(") f(){P;puts("| Welcome User! |");P;}
Bubblegum , 43 byte
Cobalah online!
sumber
05AB1E ,
312926 byte-3 Bytes terima kasih kepada Emigna
Cobalah online!
Penjelasan
sumber
.∞
sebagai gantinyaû¨'(«
")-*-*-*^_"
to')„-*Є^_J
. :)Python 3, 62 bytes
sumber
Create a program
JavaScript, 56 bytes
JavaScript (ES6),
5048 bytes (function)-2 bytes thanks to Rick Hitckcock
sumber
alert
? Save a few bytes using a function.alert
into a.js
file and run it in your browser, it'll run._=>(s=")-*-*-*^_^*-*-*-(")+
\n| Welcome User! |\n+s
C, 75 bytes
sumber
m=")-*-*-*^_^*-*-*-(";main(){printf("%s\n| Welcome User! |\n%s",m,m);}
C# (.NET Core), 60 bytes
Try it online!
sumber
Sed, 51
Two for the price of one:
Try it online.
Try it online.
sumber
MATLAB / Octave, 53 bytes
sumber
MATLAB / Python
? This is definitely not valid python.disp
Matlab will show leadingans = \n
.disp
there as it won't conform to the exact output.ans =
is not disallowed you can save 6 bytes.Perl 5, 49 bytes
Try it online!
Uses the fact that
$\
is implicitly printed after eachprint
.sumber
say
?print
withsay
isn't really where the point of golfing lies in my opinion. But I'm not on any crusade to stop usingsay
though; I let everyone do as they like, and everyone is happy :)Charcoal,
3230 bytesTry it online! Link is to verbose version of code. Explanation:
Prints the mirror image of the top left portion of the output.
Reflects down and to the left to create the top and bottom lines and the left of the middle line.
Fixes up the middle line.
sumber
Mathematica, 52 bytes
sumber
Golang, 82 bytes
Try it online!
sumber
fmt
import, sorry.Ruby, 49 bytes
Try it online!
sumber
Minecraft Functions, 77 bytes
sumber
Braingolf, 55 bytes
Try it online!
It's 2 bytes shorter than hardcoding the output.
Explanation
sumber
PHP, 50 bytes
Try it online!
sumber
<?=$a=")-*-*-*^_^*-*-*-(","\n| Welcome User! |\n$a";
Batch, 70 bytes
I mostly enjoy this one because all the escape characters make the emoticon
^_^
look like an adorable Lovecraft abomination^^^^_^^^^
sumber
><>,
5654 bytesTry it online!
2 bytes saved by AGourd
sumber
V, 35 bytes
Try it online!
Hexdump:
Explanation:
sumber
Pyth, 41 bytes
It's boring, but I just cant find a way to creat
)-*-*-*^_^*-*-*-(
or| Welcome User! |
in less bytes than just copying the strings.try it Online
sumber
///, 42 bytes
Try it online!
Shorter than the Bubblegum solution!
sumber
Carrot, 51 bytes
Try it online!
Explanation
sumber
bash, 52 bytes
sumber
Vim, 38 Bytes
Shoutout to the homies in the comments
Original:
Where
^[
is theESC
keysumber
i)-*-*-*^_^*-*-*-(^]
is much shorter for constructing the top line. Also,Y
is equivalent toVy
i)^]8a-*^[r(9hR^_^^[
^[
at the end.YPo| Welcome User! |
P
was a thing. That's awesome though. Thanks!Java 8, 62 bytes
Try it here.
Or as full program (110 bytes):
Try it here.
Surprised there wasn't a Java answer yet.
sumber