forked from kalmar/DALGLI0
02 input
This commit is contained in:
parent
3393e46235
commit
d5ffbe9c29
@ -1,10 +1,20 @@
|
||||
let Polynomial = require('./polynomial.js');
|
||||
let mul, div, gcd;
|
||||
console.log(process.argv[2]);
|
||||
|
||||
function parseArray(x) {
|
||||
result = Array.from(x).filter(x => {
|
||||
if (x == ' ' || x == '[' || x == ']' || x == ',') return false;
|
||||
else return true;
|
||||
}).map(x => parseInt(x));
|
||||
return result;
|
||||
}
|
||||
|
||||
let n = parseInt(process.argv[2]);
|
||||
let f = new Polynomial.Class([1, 1, 1, 0, 1]);
|
||||
let g = new Polynomial.Class([0, 1, 1]);
|
||||
let p1 = parseArray(process.argv[3]);
|
||||
let p2 = parseArray(process.argv[4]);
|
||||
|
||||
let f = new Polynomial.Class(p1);
|
||||
let g = new Polynomial.Class(p2);
|
||||
mul = Polynomial.multiply(f, g, 2).coefficients;
|
||||
try {
|
||||
div = Polynomial.divide(f, g, 2).coefficients
|
||||
|
Loading…
Reference in New Issue
Block a user