Modular multiplication of polynomials Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4377   Accepted: 1980 Description Consider polynomials whose coefficients are 0 and 1. Addition of two polynomials is achieved by 'adding' the coeffici…
题意:给出f(x),g(x),h(x)的 (最高次幂+1)的值,以及它们的各项系数,求f(x)*g(x)/h(x)的余数. 这里多项式的系数只有1或0,因为题目要求:这里多项式的加减法是将系数相加/减后再模2,这样其实也就可以用异或运算来代替加减法. 思路:看代码吧,水题一个,主要在于把除法转化成减法,一次一次减就行. #include <iostream> #include <stdio.h> #include <string.h> using namespace s…
题目来源:http://poj.org/problem?id=1060 题目大意: 考虑系数为0和1的多项式.两个多项式的加法可以通过把相应次数项的系数相加而实现.但此处我们用模2加法来计算系数之和.一个实例: (x^6 + x^4 + x^2 + x + 1) + (x^7 + x + 1) = x^7 + x^6 + x^4 + x^2 同样,多项式的减法我们在求系数之差时也用模2减法,例如: (x^6 + x^4 + x^2 + x + 1) - (x^7 + x + 1) = x^7 +…
Modular multiplication of polynomials Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3239   Accepted: 1459 Description Consider polynomials whose coefficients are 0 and 1. Addition of two polynomials is achieved by 'adding' the coeffici…
这是一个相对简单的模拟,因为运算规则已经告诉了我们,并且比较简单,不要被吓到…… 思路:多项式除以另外一个多项式,如果能除,那么他的最高次一定被降低了,如果最高次不能被降低,那说明已经无法被除,就是题目要求输出的膜了,降低最高次的方法很简单,只要被除式的最高次 >= 除式的最高次,就将除式的最高次升高到与被除式一样高,然后让被除式减去它,直到不满足上述关系为止. 代码如下: #include<cstdio> #include<algorithm> #include<io…
In data structure Hash, hash function is used to convert a string(or any other type) into an integer smaller than hash size and bigger or equal to zero. The objective of designing a hash function is to "hash" the key as unreasonable as possible.…
http://poj.org/problem?id=1060 题意:多项式的运算的题目,不过这个运算有个特点,就是只要是同项的多项式,无论相加还是相减,都为0,给你三个多项式,分别为a,b,c. 要你求(a*b)%c. 思路:首先吧a*b算出来,然后,求某个项数乘以c会等于a*b的,然后把a*b的最大的幂降到c以下,求出来的就是答案. #include <stdio.h> #include <iostream> #include <string.h> #define m…
Cow Multiplication Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13312   Accepted: 9307 Description Bessie is tired of multiplying pairs of numbers the usual way, so she invented her own style of multiplication. In her style, A*B is eq…
Matrix Multiplication Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 18928   Accepted: 4074 Description You are given three n × n matrices A, B and C. Does the equation A × B = C hold true? Input The first line of input contains a posit…
A multiplication game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5622   Accepted: 2811 Description Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p =…