|
|
|
codepad
|
|
|
|
Saved pastes by novatech:
class Straddling
def initialize( key_text, n1, n2, n3 )
key_text = key_text+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key_text = key_text.upcase.split(//).uniq
@key_text = key_text
|
| view (106 lines, 17 lines of output) |
class Straddling
def initialize( key, n1, n2, n3 )
key = key+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key = key.upcase.split(//).uniq
@key = key;@n1 = n1;@n2 = n2;@n3 = n3
|
| view (102 lines, 12 lines of output) |
def julian (year, month, day)
a = (14-month)/12
y = year+4800-a
m = (12*a)-3+month
return day + (153*m+2)/5 + (365*y) + y/4 - y/100 + y/400 - 32045
|
| view (24 lines, 4 lines of output) |
#include <stdio.h>
#include <time.h>
int s(int i, int j, int a,int b){
return (i == 0 || j == (b-1)) ? \
(a*b) - (1 + i + j) : (i == (a-1) || j == 0) ?\
|
| view (19 lines, 10 lines of output) |
#include <stdio.h>
#include <time.h>
int s(int i, int j, int a,int b){
return (i == 0 || j == (b-1)) ? \
(a*b) - (1 + i + j) : (i == (a-1) || j == 0) ?\
|
| view (18 lines, 12 lines of output) |
/* print list of numbers in spiral direction */
#include <iostream>
using namespace std;
int i=0,x=25,y=10,spiral[100][100];
char direction = 'r';
|
| view (53 lines, 26 lines of output) |
/*
numeric diamond algorithm..
not sure if this is the fastest algorithm
novatech - http://wan.pengganas.net
*/
|
| view (31 lines, 56 lines of output) |
/*
* coded by novatech
* http://wan.pengganas.net
* print doreamon song (modified) malay version
* lyrics is not 100% correct because i didn't remember it
|
| view (36 lines, 8 lines of output) |
/*
find what is the smallest number that is evenly divisible by all of the numbers from 1 to 20?.
using LCM formula refer to http://en.wikipedia.org/wiki/Least_common_multiple
*/
#include <iostream>
|
| view (21 lines, 18 lines of output) |
#include <stdio.h>
/* malaysia.c will print the map of
/* peninsular malaysia in ascii form
/* copyright novatech@pengganas.net
/* http://wan.pengganas.net - July 2009
|
| view (17 lines, 69 lines of output) |