Skip to content

Instantly share code, notes, and snippets.

@triplog
triplog / checkFunc.js
Last active August 29, 2015 14:01
関数を引数に渡して実行時間と結果の配列を返す
/*
checkFunc(sq,10) で [100,1000]
checkFunc(mul,10,20) で [200,2000]
が返ってくる([結果,実行時間],※実行時間はズレることもある)
*/
//関数と引数から結果と実行時間を返す関数
function checkFunc(func){
//2番目以降の引数を配列として取得(?)
var args = Array.prototype.slice.call(arguments,1);
// console.log(func);
// Fill the empty space with the minimum number of rectangles.
// (Rectangles should not overlap each other or walls.)
// The grid size is 1 meter, but the smallest wall/floor tile is 4 meters.
// Check the blue guide button at the top for more info.
// Make sure to sign up on the home page to save your code.
var grid = this.getNavGrid().grid;
var tileSize = 4;
var width = tileSize;
for(var y = 0; y + tileSize < grid.length; y += tileSize) {
@triplog
triplog / dothi.c
Last active August 29, 2015 13:59
血の教誨師ドティのコンピュータの強さをシミュレートするためのプログラム. http://www55.atpages.jp/triplog/pg/monthly/1404/index.php
#include <stdio.h>
#include <time.h>
#include<string.h>
#include<stdlib.h>
#include "MT.h"
/*
基本的な処理の関数
*/
//min~maxの乱数発生
int dice(int min, int max){
@triplog
triplog / num2x32.php
Last active August 29, 2015 13:59
10進数→32進数(文字列).型の扱いに慣れてないからもっと良い方法があると思う.
<!doctype html>
<?php
//とにかく1文字にしたい時
function num2char($input)
{
if($input<10)
return chr(ord('0') + $input);
else
return chr(ord('a') + ($input-10));
}