- or download this
sub r {
my %h = ( I=>1, V=>5, X=>10, L=>50, C=>100, D=>500, M=>1000 );
return $h{$_};
}
print "$_: ", 0+r(), "\n" for (qw(I V X L C D M));
- or download this
I: 1
V: 5
...
C: 100
D: 500
M: 1000
- or download this
sub r {%h=(I,1,V,5,X,10,L,50,C,100,D,500,M,1000);$h{$_}}
sub r {M1000D500C100L50X10V5I1=~$_;$'}
sub r {M999D499C99L49X9V4I=~$_+$'}
- or download this
sub r {5**y/VLD//.E.(3*/M/+2*/C|D/+/X|L/)}
sub r {1 .E.~-ord()*41%52%5>>y/VLD//}
...
sub r {1 .E.(72^ord)*5/7%5>>y/VLD//}
sub r {5**y/VLD//.E.(42^88*ord)%5}
sub r {1 .E.(3^77%ord)%7>>y/VLD//}
- or download this
sub r {10**(7&69303333/ord)%9995}
sub r {10**(7&5045e8/ord)%2857} # needs 64-bit Perl
sub r {IXCMVLD=~$_;"1E@-"%9995}
sub r {XCMVLD=~$_;"1E@+"%9995} # Grimy improvement
- or download this
10**(205558%ord(r)%7)%9995 # Python
hash(r+"magicstrng")%1001 # Python (finding magicstrng is the subjec
+t of this node!)
...
10**(494254%r/9)%4999 # Ruby (no need for explicit ord in this g
+ame)
md5($r.magicstrng) # PHP (finding magicstrng is an unsolved p
+roblem)
md5($r.PQcUv)&uppp # PHP wins due to superb mf properties of
+md5
- or download this
import time
print time.time(), time.clock()
...
if i != 1: continue
print "bingo!", q0, q1, q2, q3, q4, q5, q6, q7, q8, q9
print time.time(), time.clock()
- or download this
#include <stdio.h>
#include <time.h>
...
(double) (cend-cstart) / (double)CLOCKS_PER_SEC);
return 0;
}
- or download this
#include <stdio.h>
#include <string.h>
...
do_one(sv0, sv1, ev1, sv2, ev2, sv3, ev3);
return 0;
}
- or download this
#define H_PRIME 1000003
#define HASH_LEN 11
...
}
return iret;
}
- or download this
m3 = (m2 ^ q3) * H_PRIME;
d3 = (d2 ^ q3) * H_PRIME;
...
x3 = (x2 ^ q3) * H_PRIME;
v3 = (v2 ^ q3) * H_PRIME;
i3 = (i2 ^ q3) * H_PRIME;