1
0
forked from kalmar/DALGLI0
DALGLI0/Main.java

38 lines
1.0 KiB
Java
Raw Normal View History

2018-06-08 19:31:03 +02:00
import java.util.ArrayList;
2018-05-31 08:20:14 +02:00
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
2018-06-08 19:31:03 +02:00
int mod = Integer.parseInt(args[0]);
Polynomials poly = new Polynomials(mod);
ArrayList<Integer> f = new ArrayList<>();
ArrayList<Integer> g = new ArrayList<>();
2018-05-31 08:20:14 +02:00
2018-06-08 19:31:03 +02:00
String[] tmpString = args[1].split(",");
String[] tmpString2 = args[2].split(",");
2018-05-31 08:20:14 +02:00
2018-06-08 19:31:03 +02:00
for (String s : tmpString){
f.add(Integer.parseInt(s));
}
for (String s : tmpString2){
g.add(Integer.parseInt(s));
2018-05-31 08:20:14 +02:00
}
2018-06-08 19:31:03 +02:00
System.out.print("[");
for (int i : poly.multiply(f, g)){
System.out.print(i + " ");
2018-05-31 08:20:14 +02:00
}
2018-06-08 19:31:03 +02:00
System.out.print("], [");
for (int i : poly.divModN(f, g)){
System.out.print(i + " ");
2018-05-31 08:20:14 +02:00
}
2018-06-08 19:31:03 +02:00
System.out.print("], [");
for (int i : poly.gcc(f, g)){
System.out.print(i + " ");
2018-05-31 08:20:14 +02:00
}
2018-06-08 19:31:03 +02:00
System.out.print("]");
2018-05-31 08:20:14 +02:00
}
2018-06-08 19:31:03 +02:00
}