文件名称:polynomials
介绍说明--下载内容均来自于网络,请自行研究使用
Descr iption
给定两个多项式P(x)与Q(x),通过链表实现它们的加法。
Input
有若干组,每组有2个多项式。每组输入时先输入第1个多项式,再输入第2个多项式。每组用若干对整数表示,依序每两个相邻的整数表示多项式的一项,分别是它的系数和幂。当输入的幂为负数时,表示一个多项式的结束。一个多项式中各项的次序是随机的。
Output
对每组中两个多项式,先输出“Case #:”,其中“#”是测试数据序号。接着在下面三行上分别输出这两多项式,以及这两多项式的和。要求按降幂排列输出多项式的各项,每一项用(a,n)对的形式,其中a是系数,n是幂。相邻两对之间无空格。系数为零的项不输出。对零多项式,只输出0。
Sample Input
-1 2 3 -1 1 2 2 -1
-2 2 4 4 3 -1 2 2 6 1 5 -1
Sample Output
Case 1:
(-1,2)
(1,2)
0
Case 2:
(4,4)(-2,2)
(2,2)(6,1)
(4,4)(6,1)-Descr iption
Given two polynomials P (x) and Q (x), in addition to achieve them through the list.
Input
There are a number of groups, each with two polynomials. When you enter the first of each group enter a polynomial, then enter the first two polynomials. Each with several pairs of whole numbers sequentially every two adjacent integer representation of a polynomial, respectively, and its power factor. When the input power is negative, indicating the end of a polynomial. In the order of a polynomial it is random.
Output
For each group of two polynomials, first output Case#: , where # is the number of test data. Then on the next three lines are output two polynomials, as well as the two polynomials and. Requirements in descending arrangement of the output polynomial, each with (a, n) of the form, where a is a coefficient, n is a power. No space between two adjacent pairs. Coefficient of zero entries are not output. Zero polynomial, only the output 0.
Sample Input
-123-1122-1
给定两个多项式P(x)与Q(x),通过链表实现它们的加法。
Input
有若干组,每组有2个多项式。每组输入时先输入第1个多项式,再输入第2个多项式。每组用若干对整数表示,依序每两个相邻的整数表示多项式的一项,分别是它的系数和幂。当输入的幂为负数时,表示一个多项式的结束。一个多项式中各项的次序是随机的。
Output
对每组中两个多项式,先输出“Case #:”,其中“#”是测试数据序号。接着在下面三行上分别输出这两多项式,以及这两多项式的和。要求按降幂排列输出多项式的各项,每一项用(a,n)对的形式,其中a是系数,n是幂。相邻两对之间无空格。系数为零的项不输出。对零多项式,只输出0。
Sample Input
-1 2 3 -1 1 2 2 -1
-2 2 4 4 3 -1 2 2 6 1 5 -1
Sample Output
Case 1:
(-1,2)
(1,2)
0
Case 2:
(4,4)(-2,2)
(2,2)(6,1)
(4,4)(6,1)-Descr iption
Given two polynomials P (x) and Q (x), in addition to achieve them through the list.
Input
There are a number of groups, each with two polynomials. When you enter the first of each group enter a polynomial, then enter the first two polynomials. Each with several pairs of whole numbers sequentially every two adjacent integer representation of a polynomial, respectively, and its power factor. When the input power is negative, indicating the end of a polynomial. In the order of a polynomial it is random.
Output
For each group of two polynomials, first output Case#: , where # is the number of test data. Then on the next three lines are output two polynomials, as well as the two polynomials and. Requirements in descending arrangement of the output polynomial, each with (a, n) of the form, where a is a coefficient, n is a power. No space between two adjacent pairs. Coefficient of zero entries are not output. Zero polynomial, only the output 0.
Sample Input
-123-1122-1
(系统自动生成,下载前可以参看下载内容)
下载文件列表
polynomials.exe
polynomials.o
polynomials.cpp