Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

programming contest NR. godamind idk

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!

Name: Anonymous 2010-05-22 15:04

>>1
print "Sussman"

Name: Anonymous 2010-05-22 15:05

>>2
/facepalm

Name: Anonymous 2010-05-22 15:06

>>1
Next time learn to phrase your assignments, otherwise you get >>2.

Name: Anonymous 2010-05-22 15:07

>>3
depart to the imageboards, please.

Name: >>4 2010-05-22 15:07

Also, ´´retarded quotes''.

Name: Anonymous 2010-05-22 15:11

>>6
˝Sussman˝

better now?

Name: Anonymous 2010-05-22 15:12

puts ["s", "u", "s", "s", "m", "a", "n"].shuffle

Runs very fast.

Name: Anonymous 2010-05-22 15:14

>>8
Too Bad Ruby is Slow as Fuck1

_____________________________
1 http://dis.4chan.org/read/prog/1221034939

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".

Name: Anonymous 2010-05-22 15:42

>>10
Rails is slower, but vanilla Ruby is plenty slow. See also the Dabian Shout-Out.

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.

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"))

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 :(

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.

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

Name: Anonymous 2010-05-22 20:11

print "msnsSua".

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>>

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;
}

Name: Anonymous 2010-05-22 21:13

>>16
FWIW, I chuckled.

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;
}

Name: Anonymous 2010-05-23 8:46

...then the word ``Sussman' contains what?

Name: Anonymous 2010-11-26 7:02

Name: Anonymous 2011-02-04 13:07


Don't change these.
Name: Email:
Entire Thread Thread List