From d5ee30573fe6ec7aa9ce4af60986fabd969d9306 Mon Sep 17 00:00:00 2001 From: verbatim144 Date: Thu, 7 Jun 2018 10:58:40 +0200 Subject: [PATCH] Zad-2 --- Main.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Main.java diff --git a/Main.java b/Main.java new file mode 100644 index 0000000..5e00bf6 --- /dev/null +++ b/Main.java @@ -0,0 +1,53 @@ +import java.util.ArrayList; +import java.util.Scanner; + +public class Main { + + public static void main(String[] args) { + + ArrayList A = new ArrayList<>(); + ArrayList B = new ArrayList<>(); + + Scanner input = new Scanner(System.in); + System.out.print("Podaj modulo: "); + int m = input.nextInt(); + + System.out.print("Podaj najwyższą potęgę współczynników A: "); + int n = input.nextInt(); + System.out.print("Podaj liczby A: "); + for(int i=0; i<=n; i++){ + A.add(input.nextInt()); + } + + System.out.print("Podaj najwyższą potęgę współczynników B: "); + n = input.nextInt(); + System.out.print("Podaj liczby B: "); + for(int i=0; i<=n; i++){ + B.add(input.nextInt()); + } + mnozenie(A,B, A.size(), B.size(), m); + + + } + + public static void mnozenie(ArrayList A, ArrayList B, int A_size, int B_size, int modulo){ + ArrayList wynik = new ArrayList<>(); + int[] pr = new int[A_size+B_size-1]; + + for (int i = 0; i