【UVa】[1524]Hot or Cold?
2016-07-19 10:53
369 查看
多项式的积分问题
算出积分后除以所用时间
#include<stdio.h> #include<math.h> double a[120]; double f(int n,double m) { double sum=0; for(int i=0; i<=n; i++) { sum+=(double)pow(m,(double)(i+1))*a[i]/(i+1); } return sum; } int main() { int n; while(scanf("%d",&n),n) { for(int i=n; i>=0; i--) scanf("%lf",&a[i]); double s,e; scanf("%lf %lf",&s,&e); printf("%.3lf\n",(f(n,e)-f(n,s))/(e-s)); } return 0; }
题目地址:【UVa】[1524]Hot or Cold?
相关文章推荐
- 1.10055 - Hashmat the brave warrior
- 2.10071 - Back to High School Physics
- 3.458 - The Decoder
- 4.694 - The Collatz Sequence
- 6.494 - Kindergarten Counting Game
- 7.490 - Rotating Sentences
- 8.414 - Machined Surfaces
- 9.488 - Triangle Wave
- A.457 - Linear Cellular Automata
- B.489 - Hangman Judge
- C.445 - Marvelous Mazes
- 1.10494 - If We Were a Child Again
- 2.424 - Integer Inquiry
- 3.10250 - The Other Two Trees
- 5.465 - Overflow
- 6.113 - Power of Cryptography
- 7.10161 - Ant on a Chessboard
- 8.621 - Secret Research
- 9.401 - Palindromes
- A.537 - Artificial Intelligence?