Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for [old] Counting Tiles by Sim0000
"use strict";
function countingTiles(r){
solid = 0
for(x = 1; x <= Math.floor(r); x++){
solid += Math.floor(Math.sqrt(r * r - x * x))
}
return [4 * solid, 8 * Math.ceil(r) - 4]
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(countingTiles(2).toString(), [4, 12].toString(), "N=2");
assert.equal(countingTiles(3).toString(), [16, 20].toString(), "N=3");
assert.equal(countingTiles(2.1).toString(), [4, 20].toString(), "N=2.1");
assert.equal(countingTiles(2.5).toString(), [12, 20].toString(), "N=2.5");
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
July 20, 2016
Comments: