This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub r { int(rand(49)) } | |
$n1 = r(); | |
do { $n2 = r(); } until ($n2 != $n1); | |
do { $n3 = r(); } until ($n3 != $n1 && $n3 != $n2); | |
do { $n4 = r(); } until ($n4 != $n1 && $n4 != $n2 && $n4 != $n3); | |
do { $n5 = r(); } until ($n5 != $n1 && $n5 != $n2 && $n5 != $n3 && $n5 != $n4); | |
do { $n6 = r(); } until ($n6 != $n1 && $n6 != $n2 && $n6 != $n3 && $n6 != $n4 && $n6 != $n5); | |
do { $n7 = r(); } until ($n7 != $n1 && $n7 != $n2 && $n7 != $n3 && $n7 != $n4 && $n7 != $n5 && $n7 != $n6); | |
print "$n1 $n2 $n3 $n4 $n5 $n6 $n7\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def check(n): | |
for x in range(7): | |
for y in range(x + 1, 7): | |
if (int(n / 49 ** x % 49) == int(n / 49 ** y % 49)): | |
return False | |
return True | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$_ = 'h' x 49 . '4' x 7; | |
while (/4/) { | |
$h = int(rand(49)); | |
print $h + s/4//, "\n" if (s/(?<=^.{$h})h/./); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function f(x) { } | |
c = 7; | |
while (c > 0) { | |
r = Math.floor(Math.random() * 49); | |
if (! f(r)) { | |
console.log(r + 1); | |
f = function(r, f, x) { return x == r || f(x) }.bind(null, r, f); | |
c--; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
const int N = 49; | |
const int M = 7; | |
long long l(const long long n, const int i) { // left | |
return (i == M - 1) ? n : l(n, i + 1) / (N - (i + 1)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = 49 | |
M = 7 | |
def l(n, i) # left | |
(i == M - 1) ? n : l(n, i + 1) / (N - (i + 1)) | |
end | |
def b(n, i) # branch | |
l(n, i) % (N - i) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
const int N = 49; | |
const int M = 7; | |
//const int N = 5; | |
//const int M = 3; | |
long long l(const long long n, const int i) { // left |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -std=c++0x a.cpp 2>&1 | grep Print | |
const int N = 49; | |
const int M = 7; | |
template <long long n, int i> struct L { enum : long long { | |
v = L<n, i + 1>::v / (N - (i + 1)) | |
};}; | |
template <long long n > struct L<n, M - 1> { enum : long long { | |
v = n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a =: 20 15 30 45 | |
((#~0<|)(0=|10|a)*1+i.#a)-1 | |
0 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -pedantic -std=c99 a.c | |
#include <stdio.h> | |
#include <string.h> | |
void f(char *msg, int size, int pos) { | |
if (pos >= size) | |
return; | |
int len = (msg[pos] & 0x80) == 0 ? 1 : (msg[pos] & 0xe0) == 0xc0 ? 2 : 3; | |
char buf[len]; | |
memcpy(buf, msg + pos, len); |