编程介的小学生 2019-02-21 11:59 采纳率: 20.5%
浏览 344

有关多项式方程的极值的计算的一个问题利用C语言的解答的方式是什么思路

Problem Description
YY and LMY both love mathematics. One day LMY wrote down an integer 3 and two polynomials andon a piece of paper.
YY noticed that 3 is a prime. Besides, he found that f(x) has a degree strictly less than g(x). And all coefficients of the two polynomials are between 0 and 2,
inclusively. His most important discovery is, that there is a polynomial , such that

Then YY added a restriction: all coefficients of h(x) must be between 0 and 2 inclusively, and its degree must be less than g(x). Finally, he found that the polynomial
h(x) with such properties is unique.

The property that a polynomial f(x) with all its coefficients between 0 and p-1 inclusively, where p is a prime number, is called that f(x) is in the polynomial ring
defined on field Zp. Note that. Such a polynomial ring is called Zp[x].

Then h(x) is called a multiplicative inverse of f(x), defined on the quotient ring Zp[x]/(g(x)). YY wonders if such an inverse always exists and is unique.

Input
Input contains multiple test cases.

For each test case, the first line contains a prime number p.

The following line consists of two positive integers n and m (n<m), indicating the degrees of f(x) and g(x).

The following line contains n+1 integers, a0, a1… an, indicating the coefficients of f(x), i.e.,. It is guaranteed that f(x) is
in Zp[x] and an≠0.

The following line contains m+1 integers, b0, b1… bm, indicating the coefficients of g(x), i.e.,. It is guaranteed that g(x)
is in Zp[x] and bm≠0.

Input ends with a line where p=0.

Output
For each test case, if the multiplicative inverse of f(x) (defined on Zp[x]/(g(x))) does not exist, output only one line containing “NO SOLUTION”(quotes excluded);
if the multiplicative inverse is not unique, output only one line containing “NO UNIQUE SOLUTION”(quotes excluded). Otherwise, you should output two lines
indicating the unique multiplicative inverse h(x), using the same format as in the input.

Sample Input
2
1 2
0 1
0 0 1
3
1 3
1 1
1 1 0 1
0

Sample Output
NO SOLUTION
2
2 2 1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
    • ¥15 C# datagridview 单元格显示进度及值
    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配