programming contest NR. godamind idk
1
Name:
Anonymous
2010-05-22 15:01
So we didnt have one in a long time.
The assignment:
Write a program which can print all the characters in the word ´´Sussman'' in a random order, but none of the characters may appear more times then the word ´´Sussman'' contains.
GO!
2
Name:
Anonymous
2010-05-22 15:04
3
Name:
Anonymous
2010-05-22 15:05
4
Name:
Anonymous
2010-05-22 15:06
>>1
Next time learn to phrase your assignments, otherwise you get
>>2 .
5
Name:
Anonymous
2010-05-22 15:07
>>3
depart to the imageboards, please.
6
Name:
>>4
2010-05-22 15:07
Also, ´´retarded quotes''.
7
Name:
Anonymous
2010-05-22 15:11
>>6
˝Sussman˝
better now?
8
Name:
Anonymous
2010-05-22 15:12
puts ["s", "u", "s", "s", "m", "a", "n"].shuffle
Runs very fast .
9
Name:
Anonymous
2010-05-22 15:14
>>8
Too Bad Ruby is Slow as Fuck 1
_____________________________
1 http://dis.4chan.org/read/prog/1221034939
10
Name:
Anonymous
2010-05-22 15:26
>>9
Hmm, isn't the origin of this phrase "Too Bad Ruby
on Rails is Slow as Fuck"? I'm really struggling to remember when it morphed into the more general "Ruby is Slow as Fuck".
11
Name:
Anonymous
2010-05-22 15:42
>>10
Rails
is slower, but vanilla Ruby is plenty slow. See also the Dabian Shout-Out.
12
Name:
Anonymous
2010-05-22 15:43
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
int main(int c, char **v) {
char Sussman[] = "Sussman";
printf("%s\n", strfry(Sussman));
return 0;
}
Jeez.
13
Name:
Anonymous
2010-05-22 15:49
>>1
(defun shuffle (sequence)
(sort (copy-seq sequence) #'< :key #'(lambda (x) (declare (ignore x)) (random 1.0))))
(princ (shuffle "Sussman"))
14
Name:
Anonymous
2010-05-22 15:55
>>12
I came to this thread hoping to show off my
strfry fu and you were already here :(
15
Name:
Anonymous
2010-05-22 16:33
>>14
I think it will be 12 years this summer that I've been waiting for an opportunity to
strfry() in public.
16
Name:
Anonymous
2010-05-22 20:07
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(void) {
char sussman[] = { 'S', 'u', 's', 's', 'm', 'a', 'n', '\0' };
int n = strlen( sussman ) -1;
srand( time( NULL ) );
while (n) {
int r = rand() % n;
char temp = sussman[n];
sussman[n] = sussman[r];
sussman[r] = temp;
--n;
}
printf("%s\n", sussman);
return 0;
}
http://codepad.org/H7q6N4gy
17
Name:
Anonymous
2010-05-22 20:11
print "msnsSua".
18
Name:
Anonymous
2010-05-22 20:20
sussman.hs:
main=print "Sussman"
stdout:
$ghc -O2 -o sussman sussman.hs
$./sussman +RTS -t
"Sussman"
<<ghc: 14208 bytes, 1 GCs, 5884/5884 avg/max bytes residency (1 samples), 1M in use, 0.00 INIT (0.01 elapsed), 0.00 MUT (0.00 elapsed), 0.00 GC (0.00 elapsed) :ghc>>
19
Name:
Anonymous
2010-05-22 20:28
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
char suss[8] = "Sussman";
int main()
{
unsigned int iseed = (unsigned int) time(NULL);
srand(iseed);
short chars = 0;
char c;
int i;
while (chars < 7){
if ((c = suss[i = rand() % 7]) != 0){
suss[i] = 0;
printf("%c", c);
chars++;
}
}
return 0;
}
20
Name:
Anonymous
2010-05-22 21:13
21
Name:
Anonymous
2010-05-23 7:18
Also, in sepples:
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main() {
srand( time(NULL) );
string text = "Sussman";
while( text.size() ) {
unsigned int which = rand()%text.size();
cout << text[which];
text.erase( which, 1 );
}
cout << endl;
return 0;
}
22
Name:
Anonymous
2010-05-23 8:46
...then the word ``Sussman' contains what?
23
Name:
Anonymous
2010-11-26 7:02
24
Name:
Anonymous
2011-02-04 13:07