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
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; | |
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
#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); |
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
// http://www.facebook.com/groups/javascript.tw/194457013988978/ | |
var n2ed = [ [ [0, 1], [1, 1] ], [ [0, 0], [1, 0], [2, 2], [3, 2] ], [ [2, 1], [3, 1] ] ]; | |
function comp(val, edge) { | |
if (edge == 0) return val + 7; | |
if (edge == 1) return val / 2; | |
if (edge == 2) return val * 3; | |
if (edge == 3) return val - 5; | |
} |
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
for (var n = 0; 1; n++) | |
if (ok(n)) | |
show(n); | |
function ok(n) { | |
var v = 2011 + 7; | |
while (1) { | |
var x = n % 4; | |
if (x == 0) v = (v + 7) / 2; | |
else if (x == 1) v = (v / 2) + 7; |
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 java.io.IOException; | |
public class Main { | |
public static void main(String[] args) throws IOException, InterruptedException { | |
runAndKill("java A", 3000); | |
} | |
public static void runAndKill(String cmd, final long millis) throws IOException, InterruptedException { | |
final Process proc = Runtime.getRuntime().exec(cmd); | |
new Thread() { |