d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Yo, Canadians
Prev191011121314Next
Add Reply New Topic New Poll
Member
Posts: 13,630
Joined: Dec 4 2009
Gold: 0.00
Jun 6 2011 11:57pm
Quote (AbDuCt @ Jun 6 2011 10:47pm)
Code
#include <stdio.h>
#include <stdlib.h>

int odd(int val);
void algo(int a);


int main()
{
   algo(9);
   return 0;
}

void algo(int a)
{
   int temp = a;

   printf("%d> ", temp);

   while(temp != 1)
   {
       if(odd(temp) == 1)
       {
           temp = temp * 3 + 1;
           printf("%d> ", temp);
       }
       else if(odd(temp) == 0)
       {
           temp = temp / 2;
           printf("%d> ", temp);
       }
   }
}

int odd(int val)
{
   if((val % 2) == 1)
       return 1;
   else
       return 0;
}


You don't need to make the temp object. NOOB DETECTED
Member
Posts: 12,441
Joined: Mar 22 2007
Gold: 144.00
Jun 7 2011 12:13am
Quote (DeadShell @ Jun 3 2011 01:32pm)
Screw you nazis for killing jews systematically.


Best comment.
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jun 7 2011 12:15am
Quote (BreakPoint @ Jun 6 2011 10:57pm)
You don't need to make the temp object. NOOB DETECTED


actually i was going to do some weird shit by calculating a numbers efficiency in the algo by taking the beginning number divided by the number of rounds it took it to reach 1

all add that now and codebin it

Member
Posts: 6,522
Joined: Jun 5 2008
Gold: 0.00
Jun 7 2011 12:19am
Quote (AbDuCt @ Jun 7 2011 01:15am)
actually i was going to do some weird shit by calculating a numbers efficiency in the algo by taking the beginning number divided by the number of rounds it took it to reach 1

all add that now and codebin it


Code
public class GetOnMyLevel {
     public static void main(String[] args) {
            System.out.println("Abduck is a noob");
}

}
Member
Posts: 12,441
Joined: Mar 22 2007
Gold: 144.00
Jun 7 2011 12:20am
Quote (DeadShell @ Jun 6 2011 10:19pm)
Code
public class GetOnMyLevel {
    public static void main(String[] args) {
           System.out.println("Abduck is a noob");
}

}


Lol'd cuz u silly.
Member
Posts: 13,630
Joined: Dec 4 2009
Gold: 0.00
Jun 7 2011 12:22am
Quote (DeadShell @ Jun 6 2011 11:19pm)
Code
public class GetOnMyLevel {
     public static void main(String[] args) {
            System.out.println("Abduck is a noob");
}

}


Code
def trollolol():
   print 'DeadShell is more noob'
Member
Posts: 12,441
Joined: Mar 22 2007
Gold: 144.00
Jun 7 2011 12:23am
Quote (BreakPoint @ Jun 6 2011 10:22pm)
Name change fund - 1875/1500[/CODE]


??
Member
Posts: 6,522
Joined: Jun 5 2008
Gold: 0.00
Jun 7 2011 12:26am
Quote (BreakPoint @ Jun 7 2011 01:22am)
Code
def trollolol():
   print 'DeadShell is more noob'


Code
def base36encode(number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
   """Convert positive integer to a base36 string."""
   if not isinstance(number, (int, long)):
       raise TypeError('number must be an integer')

   
   if number == 0:
       return alphabet[0]

   base36 = ''

   sign = ''
   if number < 0:
       sign = '-'
       number = - number

   while number != 0:
       number, i = divmod(number, len(alphabet))
       base36 = alphabet[i] + base36

   return sign + base36

def base36decode(number):
   return int(number, 36)

print base36encode(011011100110111100100000011001100010000001110101)
Member
Posts: 13,630
Joined: Dec 4 2009
Gold: 0.00
Jun 7 2011 12:26am
Quote (Masta_B @ Jun 6 2011 11:23pm)
??


Don't worry about it girl
Member
Posts: 13,630
Joined: Dec 4 2009
Gold: 0.00
Jun 7 2011 12:28am
Quote (DeadShell @ Jun 6 2011 11:26pm)
Code
def base36encode(number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
   """Convert positive integer to a base36 string."""
   if not isinstance(number, (int, long)):
       raise TypeError('number must be an integer')

   
   if number == 0:
       return alphabet[0]

   base36 = ''

   sign = ''
   if number < 0:
       sign = '-'
       number = - number

   while number != 0:
       number, i = divmod(number, len(alphabet))
       base36 = alphabet[i] + base36

   return sign + base36

def base36decode(number):
   return int(number, 36)

print base36encode(011011100110111100100000011001100010000001110101)


Noice.
Go Back To Computers & IT Topic List
Prev191011121314Next
Add Reply New Topic New Poll