本文最后更新于:2025-05-25T19:26:52+08:00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| #include<cstdio> int main() { int c,t,f; scanf("%d",&c); double sum = 0; for(int j = 0;j < c;++j) { sum = 0; f= 1; scanf("%d",&t); for(int i = 1;i<=t;++i) { sum += 1/double((i*f)); f *= -1; } printf("%.2f\n",sum); } }
|
hdu_2011多项式求和
http://example.com/2013/07/15/oj-hdu2011.html