当前位置:编程学习 > C/C++ >>

HDUOJ 2086推导

已知A1=(A0+A2)/2 - C1, A2=(A1+A3)/2 - C2 , ...
 
=>A1+A2 = (A0+A2+A1+A3)/2 - (C1+C2)
 
=>A1+A2 = A0+A3 - 2(C1+C2) 
 
类似的有:
 
A1+A2 = A0+A3 - 2(C1+C2)
 
A1+A3 = A0+A4 - 2(C1+C2+C3)
 
A1+A4 = A0+A5 - 2(C1+C2+C3+C4)
 
...
 
A1+An = A0+An+1 - 2(C1+C2+...+Cn)
 
A1+A1 = A0+A2 - 2(C1) (本来就是)
 
----------------------------------------------------- 左右求和
 
(n+1)A1+(A2+A3+...+An) = nA0 +(A2+A3+...+An) + An+1 - 2(nC1+(n-1)C2+...+2Cn-1+Cn)
 
=> (n+1)A1=nA0 + An+1 - 2(nC1+(n-1)C2+...+2Cn-1+Cn)
 
=> A1 = [nA0 + An+1 - 2(nC1+(n-1)C2+...+2Cn-1+Cn)]/(n+1)
补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,