有关于一个多项式的问题.
要求为Please enter the maximum degree of the polynomial: 3
Please enter the coefficients: 1 0 -1 4
The polynomial is 1 x^3 + 0 x^2 + -1 x + 4
Its reciprocal is 4 x^3 + -1 x^2 + 0 x + 1
The polynomial is not self-reciprocal
Please enter the maximum degree of the polynomial: 4
Please enter the coefficients: 0 1 0 1 0
The polynomial is 0 x^4 + 1 x^3 + 0 x^2 + 1 x + 0
Its reciprocal is 0 x^4 + 1 x^3 + 0 x^2 + 1 x + 0
The polynomial is self-reciprocal
比较两个式子就比较系数 a[0]=a[max] a[1]=a[max-1]....这个用if怎么说..
关于输入我的代码是这样的
#include<stdio.h>
int main(void)
{
int a[10];
int i;
int max;
printf("Please enter the maximum degree of the polynomial: ");
scanf("%d", &max);
printf("Please enter the coefficients: ");
for(i=0;i<max+1;i++){
scanf("%d",&a[i]);
}
printf("The polynomial is ");
}
这样正确么?我才学C....求各路大神帮忙
[ 本帖最后由 given01 于 2012-11-18 01:12 编辑 ]