This file contains hidden or 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 main() { | |
var | |
i, j, w, h, t, l, | |
line, cache, map, isLoop, | |
len = input.length; | |
for(i = 0; i < len; i++) { | |
line = input[i].split(' '); | |
h = parseInt(line[0], 10); | |
w = parseInt(line[1], 10); | |
if(w === 0 && h === 0) break; |
This file contains hidden or 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 main() { | |
var | |
i, | |
line, words, | |
dict = {}, | |
len = input.length; | |
input.forEach(function(line) { | |
if(line.trim() === '') return; | |
line = line.split(' '); | |
if(!dict[line[0]]) { |
This file contains hidden or 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
while s = gets | |
break if s.strip == "" | |
_ = s.match /([0-9X]+)\+([0-9X]+)\=([0-9X]+)/ | |
a = _[1] | |
b = _[2] | |
c = _[3] | |
answer = nil | |
(0..9).each do|i| | |
next if i == 0 && (a != 'X' && a[0] == 'X' || | |
b != 'X' && b[0] == 'X' || |
This file contains hidden or 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
/** | |
* @fileOverview 竹内関数のベンチマーク | |
* node tak.js name x y z | |
* と実行してください。 | |
* @author あらっきぃ(twitter:alucky0707) | |
* @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a> | |
*/ | |
var | |
util = require('util'); |
This file contains hidden or 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
$ node tak.js simple 13 7 0 |
This file contains hidden or 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
@defined_patterns = File.read("defined_patterns.dat", encoding: Encoding::UTF_8).split("\n").map{|s|s.split(":#")} | |
@default_messages = File.read("default_messages.dat", encoding: Encoding::UTF_8).split("\n") | |
def generateReply(inputMessage) | |
matched = [@default_messages[rand @default_messages.length]] | |
@defined_patterns.each do|pattern, result| | |
if inputMessage.index(pattern) | |
matched << result | |
end | |
end |
This file contains hidden or 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 main() { | |
var | |
i, j, n, m, x, | |
len = input.length; | |
for(i = 0; i < len; i++) { | |
n = parseInt(input[i], 10); | |
if(n === 0) break; | |
m = ~~(n / 2); | |
for(x = 0, j = 0; primes[j] <= m; j++) { | |
if(primesTable[n - primes[j]]) x++; |
This file contains hidden or 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
module.exports = (function() { | |
/* constructor */ | |
function Search(arr){ | |
if(!(this instanceof Search)) return new Search(arr); | |
this._arr = arr; | |
this._createTable(); | |
} | |
var |
This file contains hidden or 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
var | |
async = require('async'), | |
ideone = require('./jsonrpc').createClient('http://ideone.com/api/1/service.json'); | |
var | |
user = 'your user', | |
pass = 'your pass', | |
lang = {'python': 4, 'ruby': 17}['ruby'], | |
src = 'puts "Hello, World!"', | |
input = ''; |
This file contains hidden or 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
// TODO: コメント書け! | |
(function(exports) { | |
var | |
debug = false; | |
function extend(trait, target) { | |
var | |
p; | |
for(p in trait) { | |
target[p] = trait[p]; |