题目要求:
函数接口定义:
double f( int n, double a[], double x );
裁判测试程序样例:
#include <stdio.h>
#define MAXN 10
double f( int n, double a[], double x );
int main()
{
int n, i;
double a[MAXN], x;
scanf("%d %lf", &n, &x);
for ( i=0; i<=n; i++ )
scanf("%lf", &a[i]);
printf("%.1f\n", f(n, a, x));
return 0;
}
/* 你的代码将被嵌在这里 */
测试代码:
double f( int n, double a[], double x )
{
double result=a[0],temp=1;
for(int i=1;i<=n;i++)
{
temp*=x;
result+=a[i]*temp;
}
return result;
}