Programming challenge
1
Name:
Anonymous
2009-12-27 2:04
Print "SUSSMAN\n" twice in 40 bytes or less.
2
Name:
Anonymous
2009-12-27 2:08
(progn #1=(format t "SUSSMAN~%") #1#)
3
Name:
Anonymous
2009-12-27 2:10
(format t "SUSSMAN~&SUSSMAN~&")
4
Name:
Anonymous
2009-12-27 2:45
print'SUSSMAN\n'*2
5
Name:
Anonymous
2009-12-27 3:20
"SUSSMAN\n"
save this in a file called ``SUSSMAN\n'' and try to compile it.
should print ``SUSSMAN\n'' twice
6
Name:
Anonymous
2009-12-27 4:21
echo aa | sed 's/a/Sussman\
/g'
7
Name:
Anonymous
2009-12-27 5:25
print"Sussman\nSussman"
8
Name:
Anonymous
2009-12-27 5:26
>>7
print"Sussman\nSussman"
9
Name:
Anonymous
2009-12-27 7:05
print "sussman\n" x 2;
10
Name:
Anonymous
2009-12-27 7:07
SUSSMANxSUSSMAN, just like from some anime
11
Name:
Anonymous
2009-12-27 7:56
2.times{p"sußman"}
12
Name:
Anonymous
2009-12-27 8:30
┤○║◘☺═!├SUSSMAN◙SUSSMAN◙
13
Name:
Anonymous
2009-12-27 8:48
14
Name:
Anonymous
2009-12-27 13:04
echo sussman | tee -
15
Name:
Anonymous
2009-12-27 15:25
>>14
echo SUSSMAN | tee -
16
Name:
Anonymous
2009-12-27 15:27
17
Name:
Anonymous
2009-12-27 15:36
>>16
x
in my .${SHELL}rc
alias x='yes SUSSMAN'
18
Name:
Anonymous
2009-12-27 16:12
set the iterator to 0
set the maximum to 2
repeat while the iterator < the maximum
display dialog of the "Sussman"
set the iterator to the iterator + 1
end repeat
19
Name:
Anonymous
2009-12-27 16:13
>>17
in my .${SHELL}rc
yes SUSSMAN
20
Name:
Anonymous
2009-12-27 17:41
>>19
in my .${SHELL}rc
~/a.out
a.out is compiled from a.c
in a.c
#include <stdio.h>
#define ARBITRARY 10
int main(void)
{
int i;
for(i = 0; i < ARBITRARY; i++)
ungetc('h', stdin);
for(;;)
puts("SUSSMAN");
}
That's a total of -ARBITRARY chars used.
I bid thee good day, sir .
21
Name:
Anonymous
2009-12-27 18:33
IDENTIFICATION DIVISION.
PROGRAM-ID. PRINT-SUSSMAN-TWICE.
AUTHOR. ANONYMOUS.
**************************************************
* Program to print "SUSSMAN" twice. *
**************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. VAX-VMS.
OBJECT-COMPUTER. VAX-VMS.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 TEXT-OUT PIC X(7) VALUE 'SUSSMAN'.
01 LOOP-COUNT PIC 9 VALUE ZERO.
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
PERFORM VARYING LOOP-COUNT FROM 2 BY -1 UNTIL LOOP-COUNT = 0
DISPLAY TEXT-OUT
END-PERFORM
STOP RUN.
22
Name:
Anonymous
2009-12-27 19:21
perl -e 'print "\"SUSSMAN\\n\""x2'
23
Name:
Anonymous
2009-12-27 19:27
echo \"SUSSMAN\\n\" twice in 40 bytes or less.
24
Name:
Anonymous
2009-12-27 19:29
>>23
Oops, you said print:
echo \"SUSSMAN\\n\" twice in 40 bytes or less. | lpr
25
Name:
Anonymous
2009-12-27 20:07
<?php echo'SUSSMAN'."\n".'SUSSMAN'."\n";?>
26
Name:
Anonymous
2009-12-27 20:47
You don't say where I should print the SUSSMAN's. I say I want to print them to /dev/nul, nul, a broadcast stream, throwaway stream, etc.
Thus the entire act of printing Sussman's has no side effects, and a smart compiler could optimize this away in some circumstances. Which means that the shortest program which does this job doesn't have to do anything, and thus is 0 bytes (in a variety of languages which accept empty programs). It is the shortest solution to this challenge.
27
Name:
Anonymous
2009-12-27 20:53
Thus the entire act of printing Sussman's has no side effects, and a smart compiler could optimize this away in some circumstances
( ≖‿≖)
28
Name:
Anonymous
2009-12-27 21:46
s.bat
SussmanSussman
29
Name:
Anonymous
2009-12-27 23:38
print "Sussman\n"*2
30
Name:
Anonymous
2009-12-28 1:40
>>25
Why not
<?php echo "SUSSMAN\nSUSSMAN\n"; ?>
?
31
Name:
Anonymous
2009-12-28 12:13
>>26
I beg to differ. My program does it in -10 bytes
>>20
32
Name:
Anonymous
2009-12-28 12:48
echo sussman & echo sussman
Assuming the characters are encoded in ASCII, that's 27 bytes.
33
Name:
Anonymous
2009-12-28 14:24
In HQ9S++ it's just ss. 2 bytes.
34
Name:
Anonymous
2009-12-29 2:30
p"SUSSMAN\nSUSSMAN\n"
22 bytes
35
Name:
Anonymous
2009-12-29 10:28
>>30
Optimization. Everyone knows that single quotes in PHP are faster.
36
Name:
Anonymous
2009-12-29 10:51
>>35
I can actually imagine that this is the sort of idiotic thing that PHP would do, but [citation needed]
37
Name:
Anonymous
2009-12-29 11:07
38
Name:
Anonymous
2009-12-29 11:23
39
Name:
Anonymous
2009-12-29 12:04
40
Name:
Anonymous
2009-12-29 12:19
>>37
PHP sure is
GREAT !!
Newer Posts