Skip to content

Instantly share code, notes, and snippets.

@psqq
Last active December 11, 2015 13:47
Show Gist options
  • Save psqq/daa9edc5429c16bd0e95 to your computer and use it in GitHub Desktop.
Save psqq/daa9edc5429c16bd0e95 to your computer and use it in GitHub Desktop.
"use strict";
(function () {
var _inputData = `6 6 4`;
var _lastInputLineIndex = -1;
function readline () { return _inputData.split("\n")[++_lastInputLineIndex]; }
function write (str) { document.body.innerHTML += str.replace(/\n/g, "<br>"); }
function print (str) { write(str + "\n"); }
// You code: (variant 1)
//var n = readline().split(" ").map(function(x) { return parseInt(x); });
//print (Math.ceil(n[0]/n[2]) * Math.ceil(n[1]/n[2]));
// You code: (variant 2)
var inputData = "", t;
while (t = readline()) inputData += t;
function ni () {
var res = inputData.match(/\d+/);
if (res) inputData = inputData.slice(inputData.search(/\d/) + res[0].length);
return res && parseInt(res[0]);
}
var fl = Math.floor, cl = Math.ceil;
var n = ni(), m = ni(), a = ni();
print (cl(n/a) * cl(m/a));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment