HDU OJ u Calculate e

这是一道简单的数学计算问题   主义好输出格式就好

#include<stdio.h>

int main()

{

printf("n e\n- -----------\n");

int a[10];

a[0]=1;

for(int i=1;i<10;i++)

a[i]=a[i-1]*i;

double e[10];

e[0]=1;

for(int i=1;i<10;i++)

{

e[i]=e[i-1]+(double)1/a[i];

}

for(int i=0;i<2;i++)

printf("%d %.0lf\n",i,e[i]);

printf("%d %.1lf\n",2,e[2]);

for(int i=3;i<10;i++)

printf("%d %.9lf\n",i,e[i]);

return 0;

}

??

时间: 2024-09-29 10:50:54

HDU OJ u Calculate e的相关文章

hdu 1012:u Calculate e(数学题,水题)

u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28686    Accepted Submission(s): 12762 Problem Description A simple mathematical formula for e iswhere n is allowed to go to infinit

[C#] 逆袭——自制日刷千题的AC自动机攻克HDU OJ

前言 做过杭电.浙大或是北大等ACM题库的人一定对“刷题”不陌生,以杭电OJ为例:首先打开首页(http://acm.hdu.edu.cn/),然后登陆,接着找到“Online Exercise”下的“Problem Archive”,然后从众多题目中选择一个进行读题.构思.编程.然后提交.最后查看题解状态,如果AC了表示这一题被攻克了,否则就要重做了~一般情况下,“刷题”要求精神高度集中且经验丰富,否则很难成功AC,有时候甚至做一题要浪费半天的时间!(有时网速卡了,比抢火车票还要急!) 楼主在

HDU OJ 2159 FATE

#include <stdio.h> #include <string.h> int f[150][150] ; int w[150]; //»ñµÃ¾­Ñé int c[150]; //»¨·ÑµÄÈÌÄÍ¶È int main() { int n, m, kk, s; int i, j, k; int flag, cc; while(scanf("%d %d %d %d", &n, &m, &kk, &s )!=EOF) //

hdu oj 1285 确定比赛名次

hdu oj 1285 确定比赛名次 题目: 确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17378    Accepted Submission(s): 6939 Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,....,N进行比赛,比赛结束后,裁判委员会要将所有参

hdu oj 2544 最短路(最短路径)

最短路 Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 31874    Accepted Submission(s): 13798 Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt.但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找

poj 1517 &amp; hdu 1012 u Calculate e(简单阶乘)

POJ链接 :http://poj.org/problem?id=1517 HDU链接:http://acm.hdu.edu.cn/showproblem.php?pid=1012 Description A simple mathematical formula for e is e=Σ0<=i<=n1/i! where n is allowed to go to infinity. This can actually yield very accurate approximations o

Hdu oj 1012 u Calculate e

分析:注意格式. #include<stdio.h> int main() { int i,j,k; double sum=0; printf("n e\n- -----------\n"); printf("0 1\n1 2\n2 2.5\n"); for(i=3;i<=9;i++) { k=1; for(j=1;j<=i;j++) k*=j; sum+=1.0/k; printf("%d %.9lf\n",i,sum+

HDU 1012 u Calculate e【暴力打表,水】

u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 46844    Accepted Submission(s): 21489 Problem Description A simple mathematical formula for e is where n is allowed to go to infini

HDU 1012 u Calculate e(简单阶乘计算)

传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1012 u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 52607    Accepted Submission(s): 24106 Problem Description A simple mathematical