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

from /b/ plz Help

Name: Anonymous 2008-09-27 6:04

okay I am a starting cs major and I have one little snag

I get most of java so far but have to do:

is some number a multiple of 50

Now I divide the number by 50, Number/50 but dont know what to do after that.  This is due in a noon Saturday and I woke up early to do it can you guys help

Name: Anonymous 2008-09-29 6:31

>>1
public static void main(String[] args) {
    System.out.println("Yes");
}

Name: Anonymous 2008-09-29 8:52

package org.4chan.dis.prog.1222505434;

public class Idiots extends Object {
  pubic static void main(int argc, char* argv) {
    int input = Integer.parseInt(argv[1]);
    if (isMultipleOf50(input)) {
      std::cout << " Yes";
    } else {
      throw new IllegalArgumentException("No");
    }
  }

  /* Implemented natively using JNI for performance reasons */
  private static volatile synchronized native void strictfp boolean isMultipleOf50();
}

Name: Anonymous 2008-09-29 9:10

>>42
Using exceptions to control program flow is bad programming practice and results in a large performance hit when used in mission-critical enterprise software.

Name: Anonymous 2008-09-29 9:29

>>43
YHBT

Name: Anonymous 2008-09-29 9:32

org 4chan.dis.prog.1222505434.public;

class Idiots extends Object pubic {
  static void main int(argc char, argv* int) {
    input Integer = parseInt.argv(1[if]);
    isMultipleOf50 (input(std)) {
      cout::Yes << " else";
    } throw {
      new IllegalArgumentException No("Implemented");
    }
  }

  /* natively using JNI for performance reasons private */
  static volatile synchronized native void strictfp boolean isMultipleOf50 package();
}

Name: Anonymous 2008-09-29 10:04

>>45
EXPERT DYSLEXIC PROGRAMMER

Name: Anonymous 2008-09-29 10:07

>>44
YHBMT

Name: Anonymous 2008-09-29 10:37

>>45
I enjoyed this. I think I may have some weird and nerdy programming guro fetish.

Name: Anonymous 2008-09-29 12:00

>>48
Oh do you, Randel?

Name: Anonymous 2008-09-29 12:39

Oh, >>47 is right. IHBMT

Name: Anonymous 2008-09-29 14:19

int number;

if(log(number/50) <= 2) {
    System.out.println("Multiple of 50!");
} else {
    System.out.println("Not multiple of 50!");
}

Name: Anonymous 2008-09-29 14:20

int number;

if(log(number/50) > 2) {
    System.out.println("multiple of 50");
} else {
    System.out.println("not a multiple of 50");
}

Name: Anonymous 2008-09-29 14:23

int number;

if(log(number/50) > 2) {
    System.out.println("multiple of 50");
} else {
    System.out.println("not a multiple of 50");
}

Name: Anonymous 2008-09-29 14:23

lol

Name: Anonymous 2008-09-29 15:58

def mod50(n):
  if n >= 50:
    return mod50(n-50)
  if n < 0:
    return mod50(n+50)
  return (n==50)

Name: Anonymous 2008-09-29 17:27

>>53
actually it should be....

    public static void mult50(int number) {
       
        double logNumDiv50 = Math.log(number/50);
       
        if(logNumDiv50 < 2) {
            System.out.println(number+": multiple of 50");
        } else {
            System.out.println(number+": not a multiple of 50");
        }
    }

Name: Anonymous 2008-09-30 21:06

>>56
one word FORCED IMPLEMENTATION OF CLASSES

Name: Anonymous 2008-10-01 1:06

>>56
fffffuck

THIS IS WHY I LOVE FUNCTIONAL PROGRAMMING

double LogNumDiv50 = bullshit function;


should be a function itself

so it becomes

if ( lugnumdiv50 number < 2)

SO MUCH MORE BEAUTIFUL and DYNAMIC

ImPERATIVE IS PIG DIGUSTING

Name: Anonymous 2008-10-01 2:07

sub mult_of_50{shift=~/[50]0$/}

Name: Anonymous 2008-10-01 3:32

>>59
sub mult_of_50{1>$_[0]%50}

Name: Anonymous 2008-10-01 3:51

>>60
This doesn't use the power of REGULAR EXPRESSIONS
And $_[0] does not look as good as shift does

Name: Anonymous 2008-10-01 3:59

>>61
the power to make the code longer and slower?
and shift%50 doesn't work.

Name: Anonymous 2008-10-01 4:28

>>62
The power to solve problem in not obvious way. Seriously x%50 is too trivial, it doesn't deserve to be posted in this nice thread.

Name: Anonymous 2008-10-01 10:25

>>1
from /b/ import Help?

Name: Anonymous 2008-10-01 17:04

sed 's/^[0-9]*[50]0$/yes/;t;s/.*/no/' <<< "$num"

Name: Anonymous 2008-10-01 17:15

>>61
Thanks for the idea:

#include <string.h>
#include <stdio.h>

int main( int argc, char *argv[] ) {
    if ( argc != 2 ) return 1;
    for ( argc = 0; argc < strlen( argv[1] ); ++argc )
        if ( argv[1][argc] < '0' || argv[1][argc] > '9' )
            return 1;
    argc = strlen( argv[1] ) == 1 ? 2 : strlen( argv[1] );
    return ! ( ( argv[1][argc-2] == '0' || argv[1][argc-2] == '5' ) && ( argv[1][argc-1] == 0 || argv[1][argc-1] == '0' ) );
}

Name: Anonymous 2008-10-02 6:49

>>66
You damn fool! You're calling strlen twice on the same string! And you're iterating over the result anyway!

Name: Anonymous 2008-10-02 7:54

>>67
One word, common subexpression elimination and loop fusion, thread over.

Name: Anonymous 2008-10-02 8:01

Wait... Did we all just get trolled, or what?

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