标签:style blog http color os io for art
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2086
题目大意:只怪数学不行 网上看到的觉得很好。。。。
因为:Ai=(Ai-1+Ai+1)/2 - Ci,
附上代码
1 #include <iostream> 2 #include <cstdio> 3 4 using namespace std; 5 int main () 6 { 7 int i,j,n; 8 double sum; 9 while (~scanf("%d",&n)) 10 { 11 sum=0; 12 double a[3500],c[3500],d; 13 scanf("%lf%lf",&a[0],&a[n+1]); 14 for (i=1; i<=n; i++) 15 scanf("%lf",&c[i]); 16 a[1]=n*a[0]+a[n+1]; 17 for (i = n, j = 1; i >=1&&j <= n; j++,i--) 18 sum += i*c[j]; 19 a[1] = (a[1] - 2*sum)/(n+1); 20 //sum+=c[i]; 21 //cout<<a[1]<<endl; 22 printf ("%.2lf\n",a[1]); 23 } 24 return 0; 25 }
hdu 2086 A1 = ?,布布扣,bubuko.com
标签:style blog http color os io for art
原文地址:http://www.cnblogs.com/qq-star/p/3897930.html