From 80b3b0983dd637ff69f181f14aee7506b0935074 Mon Sep 17 00:00:00 2001 From: Krystian Madra Date: Thu, 28 Jun 2018 00:28:58 +0200 Subject: [PATCH] mod polynomial --- Main.java | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Main.java b/Main.java index faeb546..62a28a9 100644 --- a/Main.java +++ b/Main.java @@ -53,4 +53,38 @@ public class Main { public static void showPoly(LinkedList poly) { System.out.println(poly.toString()); } + + + public static int multiplier(int number, int expect, int mod) { + + /* + if(nwd(number,mod) != 1 || nwd(number,mod) != number) { + System.out.println("NIE DA SIE"); + return 0; + }*/ + + for(int i=1;i modPolynomial(int mod, LinkedList polynomial){ + + LinkedList result = new LinkedList(); + + while(!polynomial.isEmpty()) { + + if(polynomial.peek() < 0) { + + result.add(mod + polynomial.poll()); + } + else result.add(polynomial.poll() % mod); + } + return result; + } + } \ No newline at end of file