ZAD4 #33

Closed
s426182 wants to merge 18 commits from (deleted):ZAD4 into master
Showing only changes of commit 80b3b0983d - Show all commits

View File

@ -53,4 +53,38 @@ public class Main {
public static void showPoly(LinkedList<Integer> 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<mod;i++) {
if(((number*i) % mod) == expect) {
return i;
}
}
return 0;
}
public static LinkedList<Integer> modPolynomial(int mod, LinkedList<Integer> polynomial){
LinkedList<Integer> result = new LinkedList<Integer>();
while(!polynomial.isEmpty()) {
if(polynomial.peek() < 0) {
result.add(mod + polynomial.poll());
}
else result.add(polynomial.poll() % mod);
}
return result;
}
}