Hdu-2156-分数矩阵 [水题]
2017-04-05 22:13
225 查看
题目传送门
只需要求上三角矩阵的和再乘2减去n。
只需要求上三角矩阵的和再乘2减去n。
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> #include <stack> using namespace std; int main(void) { int n; while (scanf("%d", &n)) { if (n==0) break; double s=0,ss=0; for (int i = 1; i <= n; i++) { ss = ss+1.0/i; s = s + ss; } printf("%.2f\n",s*2-n); } return 0; }
相关文章推荐
- HDU 2156 分数矩阵 (水题)
- hdu 2156 分数矩阵
- hdu-2156-分数矩阵
- hdu 2156 分数矩阵
- HDU_2156 分数矩阵
- HDU 2156 分数矩阵
- HDOJ 2156 分数矩阵(水题)
- hdu 2156 分数矩阵
- HDU水题 分数矩阵
- HDU 2156 分数矩阵。
- hdu 2156 分数矩阵
- hdu 2156 分数矩阵
- HDU 2156 分数矩阵
- HDOJ(HDU) 2156 分数矩阵(嗯、求和)
- HDU 2156 分数矩阵
- hdu 2156 分数矩阵
- HDU 2156 分数矩阵
- HDU 2156 分数矩阵
- HDOJ(HDU) 2156 分数矩阵(嗯、求和)
- hdu 2156 分数矩阵