N = _fArgs[0]
P1 = N[0]
P2 = N[1]
P3 = N[2]
// area - check http://www.gottfriedville.net/mathtools/triarea.html
Area = Math.abs((P1[0]*(P2[1]-P3[1]) + P2[0]*(P3[1]-P1[1]) + P3[0]*(P1[1]-P2[1]))/2)
function length_of_factorial(N) {
if (N < 2) return 1;
sum = 0;
for (i = 2; i <= N; i++) {
sum += Math.log(i) / Math.log(10)
}
return Math.floor(sum) + 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
function processData(input) { | |
var temp = input.split('\n') | |
var [ N, I ] = temp.shift().split(' ').map( Number ) | |
// generate graph | |
var graph = [] // store in an array of Set [ 0 : [ 0, 1 ], 1 : [ 3, 2 ] ] (to prevent duplicate) | |
var relationalMap = {} // use to remember the map { 0 : 0, 1 : 0, 2 : 1, 3 : 1 } | |
for(let i = 0; i < I;i++) | |
{ |
OlderNewer